@speedy-js/speedy-types
Advanced tools
Comparing version 0.8.2-alpha.1 to 0.9.0-alpha.0
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import { AsyncSeriesBailHook, AsyncSeriesHook, AsyncSeriesWaterfallHook, SyncHook } from 'tapable'; | ||
@@ -6,2 +7,3 @@ import { CLIConfig, BuildConfig } from './config'; | ||
import { Callback } from './callback'; | ||
import { Stats } from 'fs'; | ||
export interface ISpeedyBundler { | ||
@@ -58,2 +60,6 @@ name?: string; | ||
/** | ||
* watch related hook | ||
*/ | ||
watchChange: SyncHook<[string, Stats]>; | ||
/** | ||
* bundler 关闭前触发 | ||
@@ -74,2 +80,3 @@ */ | ||
children: ISpeedyBundler[]; | ||
addWatchFile(id: string): void; | ||
} |
@@ -6,4 +6,4 @@ export declare type AssetType = 'image' | 'svg' | 'lottie' | 'lottie-image' | 'file' | 'font' | 'media' | 'style'; | ||
name?: string | Record<string, string> | ((resourcePath: string, resourceQuery: Record<string, string>, type: AssetType) => string); | ||
limit: number; | ||
raw: Raw; | ||
limit?: number; | ||
raw?: Raw; | ||
} |
@@ -11,1 +11,2 @@ export declare type HtmlOptions = { | ||
}; | ||
export declare type Html = HtmlOptions | false; |
@@ -11,1 +11,2 @@ export * from './style'; | ||
export * from './input'; | ||
export * from './analyze'; |
@@ -23,2 +23,3 @@ "use strict"; | ||
__exportStar(require("./input"), exports); | ||
__exportStar(require("./analyze"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -0,3 +1,6 @@ | ||
/** | ||
* Entry points. | ||
*/ | ||
export declare type Input = { | ||
[name: string]: string; | ||
}; |
export declare type Tag = 'COMMON_ASSET' | 'DYNAMIC_COMPONENT'; | ||
declare type PublicPathFunction = (id: string, issuer?: string, tag?: Tag) => string; | ||
export declare type Format = 'esm' | 'system' | 'cjs' | 'iife'; | ||
/** | ||
* Options for output. | ||
*/ | ||
export declare type Output = { | ||
/** | ||
* 产物目录 | ||
* The directory for output | ||
*/ | ||
path: string; | ||
publicPath: string | PublicPathFunction; | ||
filename: string; | ||
path?: string; | ||
publicPath?: string | PublicPathFunction; | ||
filename?: string; | ||
/** | ||
@@ -17,3 +20,3 @@ * It's only for internal usage | ||
chunkNames?: string; | ||
format: Format | ((chunkName: string) => Format); | ||
format?: Format | ((chunkName: string) => Format); | ||
/** | ||
@@ -23,4 +26,13 @@ * @internal | ||
*/ | ||
splitting?: boolean; | ||
}; | ||
export declare type OutputNormalized = { | ||
path: string; | ||
publicPath: string | PublicPathFunction; | ||
filename: string; | ||
entryNames?: string; | ||
chunkNames?: string; | ||
format: Format | ((chunkName: string) => Format); | ||
splitting: boolean; | ||
}; | ||
export {}; |
@@ -0,3 +1,6 @@ | ||
/** | ||
* Options for the resolver. | ||
*/ | ||
export declare type Resolve = { | ||
resolver: 'native-resolve' | 'enhanced-resolve'; | ||
resolver?: 'native-resolve' | 'enhanced-resolve'; | ||
/** | ||
@@ -17,1 +20,2 @@ * This is only valid for enhanced-resolve | ||
}; | ||
export declare type ResolveNormalized = Required<Resolve>; |
@@ -1,3 +0,2 @@ | ||
import type { DeepPartial } from 'utility-types'; | ||
import type { MinifyOptions as TerserMinifyOptions } from 'terser'; | ||
import type { MinifyOptions } from 'terser'; | ||
import type { Asset } from './asset'; | ||
@@ -11,127 +10,107 @@ import type { Style } from './style'; | ||
import type { DevServerOptions } from './dev'; | ||
import type { HtmlOptions } from './html'; | ||
interface UserConfigOptional { | ||
/** | ||
* 模式,不同的模式存在不同的默认参数 | ||
*/ | ||
mode: 'development' | 'production'; | ||
/** | ||
* 打包入口 | ||
*/ | ||
input: Input; | ||
/** | ||
* 是否分析 | ||
*/ | ||
profile: boolean; | ||
/** | ||
* 是否监听 | ||
*/ | ||
watch: boolean; | ||
/** | ||
* 输出产物 | ||
*/ | ||
output: Output; | ||
/** | ||
* 路径解析配置 | ||
*/ | ||
resolve: Resolve; | ||
/** | ||
* 日志级别 | ||
*/ | ||
logLevel: LogLevel; | ||
/** | ||
* | ||
*/ | ||
bundler: 'esbuild' | 'webpack' | 'rollup' | string; | ||
/** | ||
* 是否写入磁盘 | ||
*/ | ||
write: boolean; | ||
/** | ||
* Speedy 插件 | ||
*/ | ||
plugins: SpeedyPlugin[]; | ||
/** | ||
* 代码压缩 | ||
*/ | ||
minify: 'esbuild' | 'terser' | false; | ||
/** | ||
* 当使用 `terser` 进行代码压缩时的配置项 | ||
*/ | ||
terserOptions: TerserMinifyOptions; | ||
/** | ||
* 目标代码版本 | ||
*/ | ||
target: 'es6' | 'es5'; | ||
/** | ||
* es6 to es5 的转换器, when set false don't transpile | ||
*/ | ||
transformer: 'typescript' | 'babel' | 'swc' | false; | ||
/** | ||
* 编译宏 | ||
*/ | ||
define: Record<string, string>; | ||
/** | ||
* sourcemap 模式 | ||
*/ | ||
sourceMap: boolean | 'inline' | 'external' | 'both'; | ||
globals: Record<any, any>; | ||
style: Style; | ||
asset: Asset; | ||
splitInput?: string; | ||
external: string[]; | ||
/** | ||
* | ||
*/ | ||
dev: DevServerOptions; | ||
html: HtmlOptions | false; | ||
/** | ||
* @internal | ||
* @experimental experimental features | ||
*/ | ||
legalComments: 'none' | 'inline' | 'eof' | 'linked' | 'external'; | ||
analyze: { | ||
metafile: boolean; | ||
/** | ||
* Generate stats for analysis, Default is `false`; | ||
* @type {boolean} - Only generate `stat.json`. | ||
* @type {'server'} - Generate `stat.json` and open it in browser. | ||
* @type {Record<string, any>} - Use `server` and configure it. | ||
*/ | ||
stats: boolean | 'server' | { | ||
/** | ||
* Open Browser auto, default is `true`. | ||
*/ | ||
openBrowser?: boolean; | ||
}; | ||
}; | ||
import type { Html } from './html'; | ||
import { Analyze, AnalyzeNormalized } from './analyze'; | ||
import { OutputNormalized, ResolveNormalized } from '.'; | ||
/** | ||
* Different mode has different default args. | ||
* For example, in production mode, `minify` is enabled by default. | ||
*/ | ||
declare type Mode = 'development' | 'production'; | ||
/** | ||
* Enable profile plugin. | ||
* - `true` means enable cpuProfile. | ||
* - `hooks` means enable tapable profile. | ||
*/ | ||
declare type Profile = boolean | 'hooks'; | ||
/** | ||
* When file changed bundler will rebuild under watch mode. | ||
*/ | ||
declare type Watch = boolean; | ||
/** | ||
* Options for complication. | ||
* **Current only supported esbuild**. | ||
*/ | ||
declare type Bundler = 'esbuild' | 'webpack' | 'rollup' | string; | ||
/** | ||
* Write to disk or not. | ||
*/ | ||
declare type Write = boolean; | ||
/** | ||
* Options for minify. | ||
*/ | ||
declare type Minify = 'esbuild' | 'terser' | false; | ||
/** | ||
* Options for terser, it will enabled when `minify` is `'terser'`. | ||
*/ | ||
declare type TerserMinifyOptions = MinifyOptions; | ||
/** | ||
* The code version of output. | ||
*/ | ||
declare type Target = 'es6' | 'es5'; | ||
/** | ||
* Tools of transform es6 to es5 | ||
*/ | ||
declare type Transformer = 'typescript' | 'babel' | 'swc' | false; | ||
/** | ||
* The mode of sourcemap | ||
*/ | ||
declare type SourceMap = boolean | 'inline' | 'external' | 'both'; | ||
declare type Globals = Record<any, any>; | ||
/** | ||
* @internal | ||
* @experimental experimental features | ||
*/ | ||
declare type LegalComments = 'none' | 'inline' | 'eof' | 'linked' | 'external'; | ||
declare type Define = Record<string, string>; | ||
declare type External = string[]; | ||
export interface UserConfig { | ||
mode?: Mode; | ||
input?: Input; | ||
output?: Output; | ||
profile?: Profile; | ||
watch?: Watch; | ||
logLevel?: LogLevel; | ||
resolve?: Resolve; | ||
bundler?: Bundler; | ||
write?: Write; | ||
plugins?: SpeedyPlugin[]; | ||
minify?: Minify; | ||
terserOptions?: TerserMinifyOptions; | ||
target?: Target; | ||
transformer?: Transformer; | ||
sourceMap?: SourceMap; | ||
globals?: Globals; | ||
style?: Style; | ||
asset?: Asset; | ||
external?: External; | ||
dev?: DevServerOptions; | ||
html?: Html; | ||
legalComments?: LegalComments; | ||
analyze?: Analyze; | ||
define?: Define; | ||
} | ||
interface UserConfigRequired { | ||
} | ||
export declare type UserConfig = DeepPartial<UserConfigOptional> & UserConfigRequired; | ||
interface CLIConfigOptional extends UserConfigOptional { | ||
export interface CLIConfig extends UserConfig { | ||
/** | ||
* 项目根目录 | ||
* project root dir | ||
*/ | ||
root: string; | ||
root?: string; | ||
/** | ||
* 配置文件路径,默认为 `speedy.config.js`. | ||
* The path of config file, default by `speedy.config.js`. | ||
* | ||
* 当设定为 `false` 时,不会读取配置文件 | ||
* - `false` means do not read any config file. | ||
*/ | ||
configFile: string | false; | ||
configFile?: string | false; | ||
/** | ||
* 当前运行模式,dev 下为 'serve', build为 'build' | ||
* The mode of cli. | ||
*/ | ||
command: 'serve' | 'build'; | ||
command?: 'serve' | 'build'; | ||
} | ||
interface CLIConfigRequired extends UserConfigRequired { | ||
} | ||
export declare type CLIConfig = DeepPartial<CLIConfigOptional> & CLIConfigRequired; | ||
interface BuildConfigRequired extends CLIConfigRequired { | ||
export interface BuildConfig extends Required<CLIConfig> { | ||
logger: ILogger; | ||
analyze: AnalyzeNormalized; | ||
resolve: ResolveNormalized; | ||
output: OutputNormalized; | ||
css_resolve: (id: string, dir: string) => string; | ||
node_resolve: (id: string, dir: string) => string; | ||
css_resolve: (id: string, dir: string) => string; | ||
} | ||
export declare type BuildConfig = CLIConfigOptional & BuildConfigRequired; | ||
export {}; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* Options for log level. | ||
*/ | ||
export declare type LogLevel = 'silent' | 'error' | 'warning' | 'info' | 'debug' | 'verbose'; | ||
@@ -2,0 +5,0 @@ export interface ILoggerOptions { |
@@ -22,3 +22,3 @@ /// <reference types="node" /> | ||
name: string; | ||
apply?(compiler: SafeMerge<ISpeedyBundler, T>): void; | ||
apply(compiler: SafeMerge<ISpeedyBundler, T>): void; | ||
} | ||
@@ -28,3 +28,3 @@ export declare type EsbuildPlugin = Plugin; | ||
export declare type ResolveArgs = Pick<OnResolveArgs, 'importer' | 'path'>; | ||
export declare type ResolveResult = Pick<OnResolveResult, 'path'>; | ||
export declare type ResolveResult = Pick<OnResolveResult, 'path' | 'external'>; | ||
export declare type LoadArgs = Pick<OnLoadArgs, 'path'> & Pick<OnResolveResult, 'pluginData'>; | ||
@@ -31,0 +31,0 @@ export declare type LoadResult = Pick<OnLoadResult, 'contents' | 'loader'> & { |
{ | ||
"name": "@speedy-js/speedy-types", | ||
"version": "0.8.2-alpha.1", | ||
"version": "0.9.0-alpha.0", | ||
"description": "", | ||
@@ -25,2 +25,3 @@ "source": "src/index.ts", | ||
"@types/node": "16.10.9", | ||
"chokidar": "3.5.2", | ||
"esbuild": "0.14.5", | ||
@@ -27,0 +28,0 @@ "http-proxy-middleware": "2.0.1", |
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
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
29906
50
869
8
+ Addedchokidar@3.5.2
+ Addedanymatch@3.1.3(transitive)
+ Addedbinary-extensions@2.3.0(transitive)
+ Addedchokidar@3.5.2(transitive)
+ Addedfsevents@2.3.3(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedis-binary-path@2.1.0(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addedreaddirp@3.6.0(transitive)