API โบ @builder.io/qwik/optimizer
basename
basename(path: string, ext?: string): string;| Parameter | Type | Description | 
|---|---|---|
| path | string | |
| ext | string | (Optional) | 
Returns:
string
ComponentEntryStrategy
export interface ComponentEntryStrategycreateOptimizer
createOptimizer: (optimizerOptions?: OptimizerOptions) => Promise<Optimizer>;Diagnostic
export interface Diagnostic| Property | Modifiers | Type | Description | 
|---|---|---|---|
| category | DiagnosticCategory | ||
| code | string | null | ||
| file | string | ||
| highlights | SourceLocation[] | ||
| message | string | ||
| scope | string | ||
| suggestions | string[] | null | 
DiagnosticCategory
export type DiagnosticCategory = "error" | "warning" | "sourceError";dirname
dirname(path: string): string;| Parameter | Type | Description | 
|---|---|---|
| path | string | 
Returns:
string
EntryStrategy
export type EntryStrategy =
  | InlineEntryStrategy
  | HoistEntryStrategy
  | SingleEntryStrategy
  | HookEntryStrategy
  | ComponentEntryStrategy
  | SmartEntryStrategy;References: InlineEntryStrategy, SingleEntryStrategy, HookEntryStrategy, ComponentEntryStrategy, SmartEntryStrategy
extname
extname(path: string): string;| Parameter | Type | Description | 
|---|---|---|
| path | string | 
Returns:
string
format
format(pathObject: {
        root: string;
        dir: string;
        base: string;
        ext: string;
        name: string;
    }): string;| Parameter | Type | Description | 
|---|---|---|
| pathObject | { root: string; dir: string; base: string; ext: string; name: string; } | 
Returns:
string
GlobalInjections
export interface GlobalInjections| Property | Modifiers | Type | Description | 
|---|---|---|---|
| attributes? | { [key: string]: string; } | (Optional) | |
| location | 'head' | 'body' | ||
| tag | string | 
HookAnalysis
export interface HookAnalysis| Property | Modifiers | Type | Description | 
|---|---|---|---|
| canonicalFilename | string | ||
| captures | boolean | ||
| ctxKind | 'event' | 'function' | ||
| ctxName | string | ||
| displayName | string | ||
| entry | string | null | ||
| extension | string | ||
| hash | string | ||
| loc | [number, number] | ||
| name | string | ||
| origin | string | ||
| parent | string | null | 
HookEntryStrategy
export interface HookEntryStrategyInlineEntryStrategy
export interface InlineEntryStrategy| Property | Modifiers | Type | Description | 
|---|---|---|---|
| type | 'inline' | 
InsightManifest
export interface InsightManifest| Property | Modifiers | Type | Description | 
|---|---|---|---|
| manual | Record<string, string> | ||
| prefetch | { route: string; symbols: string[]; }[] | ||
| type | 'smart' | 
isAbsolute
isAbsolute(path: string): boolean;| Parameter | Type | Description | 
|---|---|---|
| path | string | 
Returns:
boolean
join
join(...paths: string[]): string;| Parameter | Type | Description | 
|---|---|---|
| paths | string[] | 
Returns:
string
MinifyMode
export type MinifyMode = "simplify" | "none";normalize
normalize(path: string): string;| Parameter | Type | Description | 
|---|---|---|
| path | string | 
Returns:
string
Optimizer
export interface Optimizer| Property | Modifiers | Type | Description | 
|---|---|---|---|
| sys | OptimizerSystem | Optimizer system use. This can be updated with a custom file system. | 
| Method | Description | 
|---|---|
| transformFs(opts) | Transforms the directory from the file system. | 
| transformFsSync(opts) | Transforms the directory from the file system. | 
| transformModules(opts) | Transforms the input code string, does not access the file system. | 
| transformModulesSync(opts) | Transforms the input code string, does not access the file system. | 
OptimizerOptions
export interface OptimizerOptions| Property | Modifiers | Type | Description | 
|---|---|---|---|
| binding? | any | (Optional) | |
| inlineStylesUpToBytes? | number | (Optional) | |
| sys? | OptimizerSystem | (Optional) | 
OptimizerSystem
export interface OptimizerSystem| Property | Modifiers | Type | Description | 
|---|---|---|---|
| cwd | () => string | ||
| dynamicImport | (path: string) => Promise<any> | ||
| env | SystemEnvironment | ||
| getInputFiles? | (rootDir: string) => Promise<TransformModuleInput[]> | (Optional) | |
| os | string | ||
| path | Path | ||
| strictDynamicImport | (path: string) => Promise<any> | 
parse
parse(path: string): {
        root: string;
        dir: string;
        base: string;
        ext: string;
        name: string;
    };| Parameter | Type | Description | 
|---|---|---|
| path | string | 
Returns:
{ root: string; dir: string; base: string; ext: string; name: string; }
Path
export interface Path| Property | Modifiers | Type | Description | 
|---|---|---|---|
| delimiter | readonly | string | |
| posix | readonly | Path | |
| sep | readonly | string | |
| win32 | readonly | null | 
| Method | Description | 
|---|---|
| basename(path, ext) | |
| dirname(path) | |
| extname(path) | |
| format(pathObject) | |
| isAbsolute(path) | |
| join(paths) | |
| normalize(path) | |
| parse(path) | |
| relative(from, to) | |
| resolve(paths) | 
QwikBuildMode
export type QwikBuildMode = "production" | "development";QwikBuildTarget
export type QwikBuildTarget = "client" | "ssr" | "lib" | "test";QwikBundle
export interface QwikBundle| Property | Modifiers | Type | Description | 
|---|---|---|---|
| dynamicImports? | string[] | (Optional) | |
| imports? | string[] | (Optional) | |
| origins? | string[] | (Optional) | |
| size | number | ||
| symbols? | string[] | (Optional) | 
QwikManifest
export interface QwikManifest| Property | Modifiers | Type | Description | 
|---|---|---|---|
| bundles | { [fileName: string]: QwikBundle; } | ||
| injections? | GlobalInjections[] | (Optional) | |
| manifestHash | string | ||
| mapping | { [symbolName: string]: string; } | ||
| options? | { target?: string; buildMode?: string; entryStrategy?: { [key: string]: any; }; } | (Optional) | |
| platform? | { [name: string]: string; } | (Optional) | |
| symbols | { [symbolName: string]: QwikSymbol; } | ||
| version | string | 
qwikRollup
export declare function qwikRollup(
  qwikRollupOpts?: QwikRollupPluginOptions,
): any;| Parameter | Type | Description | 
|---|---|---|
| qwikRollupOpts | QwikRollupPluginOptions | (Optional) | 
Returns:
any
QwikRollupPluginOptions
export interface QwikRollupPluginOptions| Property | Modifiers | Type | Description | 
|---|---|---|---|
| buildMode? | QwikBuildMode | (Optional) Build production or development.Default development | |
| csr? | boolean | (Optional) | |
| debug? | boolean | (Optional) Prints verbose Qwik plugin debug logs.Default false | |
| entryStrategy? | EntryStrategy | (Optional) The Qwik entry strategy to use while building for production. During development the type is always hook.Default { type: "smart" }) | |
| manifestInput? | QwikManifest | (Optional) The SSR build requires the manifest generated during the client build. The manifestInput option can be used to manually provide a manifest.Default undefined | |
| manifestOutput? | (manifest: QwikManifest) => Promise<void> | void | (Optional) The client build will create a manifest and this hook is called with the generated build data.Default undefined | |
| optimizerOptions? | OptimizerOptions | (Optional) | |
| rootDir? | string | (Optional) The root of the application, which is commonly the same directory as package.json and rollup.config.js.Default process.cwd() | |
| srcDir? | string | (Optional) The source directory to find all the Qwik components. Since Qwik does not have a single input, the srcDir is used to recursively find Qwik files.Default src | |
| srcInputs? | TransformModuleInput[] | null | (Optional) Alternative to srcDir, where srcInputs is able to provide the files manually. This option is useful for an environment without a file system, such as a webworker.Default: null | |
| target? | QwikBuildTarget | (Optional) Target client or ssr.Default client | |
| transformedModuleOutput? | ((transformedModules: TransformModule[]) => Promise<void> | void) | null | (Optional) Hook that's called after the build and provides all of the transformed modules that were used before bundling. | 
QwikSymbol
export interface QwikSymbol| Property | Modifiers | Type | Description | 
|---|---|---|---|
| canonicalFilename | string | ||
| captures | boolean | ||
| ctxKind | 'function' | 'event' | ||
| ctxName | string | ||
| displayName | string | ||
| hash | string | ||
| loc | [number, number] | ||
| origin | string | ||
| parent | string | null | 
qwikVite
export declare function qwikVite(qwikViteOpts?: QwikVitePluginOptions): any;| Parameter | Type | Description | 
|---|---|---|
| qwikViteOpts | QwikVitePluginOptions | (Optional) | 
Returns:
any
QwikViteDevResponse
export interface QwikViteDevResponse| Property | Modifiers | Type | Description | 
|---|---|---|---|
| _qwikEnvData? | Record<string, any> | (Optional) | |
| _qwikRenderResolve? | () => void | (Optional) | 
QwikVitePlugin
export interface QwikVitePlugin| Property | Modifiers | Type | Description | 
|---|---|---|---|
| api | QwikVitePluginApi | ||
| name | 'vite-plugin-qwik' | 
QwikVitePluginApi
export interface QwikVitePluginApi| Property | Modifiers | Type | Description | 
|---|---|---|---|
| getClientOutDir | () => string | null | ||
| getClientPublicOutDir | () => string | null | ||
| getInsightsManifest | (clientOutDir?: string | null) => Promise<InsightManifest | null> | ||
| getManifest | () => QwikManifest | null | ||
| getOptimizer | () => Optimizer | null | ||
| getOptions | () => NormalizedQwikPluginOptions | ||
| getRootDir | () => string | null | 
QwikVitePluginOptions
export type QwikVitePluginOptions =
  | QwikVitePluginCSROptions
  | QwikVitePluginSSROptions;relative
relative(from: string, to: string): string;| Parameter | Type | Description | 
|---|---|---|
| from | string | |
| to | string | 
Returns:
string
resolve
resolve(...paths: string[]): string;| Parameter | Type | Description | 
|---|---|---|
| paths | string[] | 
Returns:
string
ResolvedManifest
export interface ResolvedManifest| Property | Modifiers | Type | Description | 
|---|---|---|---|
| manifest | QwikManifest | ||
| mapper | SymbolMapper | 
SingleEntryStrategy
export interface SingleEntryStrategySmartEntryStrategy
export interface SmartEntryStrategySourceLocation
export interface SourceLocation| Property | Modifiers | Type | Description | 
|---|---|---|---|
| endCol | number | ||
| endLine | number | ||
| hi | number | ||
| lo | number | ||
| startCol | number | ||
| startLine | number | 
SourceMapsOption
export type SourceMapsOption = "external" | "inline" | undefined | null;SymbolMapper
export type SymbolMapper = Record<
  string,
  readonly [symbol: string, chunk: string]
>;SymbolMapperFn
export type SymbolMapperFn = (
  symbolName: string,
  mapper: SymbolMapper | undefined,
) => readonly [symbol: string, chunk: string] | undefined;References: SymbolMapper
SystemEnvironment
export type SystemEnvironment =
  | "node"
  | "deno"
  | "bun"
  | "webworker"
  | "browsermain"
  | "unknown";transformFs
Transforms the directory from the file system.
transformFs(opts: TransformFsOptions): Promise<TransformOutput>;| Parameter | Type | Description | 
|---|---|---|
| opts | TransformFsOptions | 
Returns:
Promise<TransformOutput>
TransformFsOptions
export interface TransformFsOptions extends TransformOptionsExtends: TransformOptions
| Property | Modifiers | Type | Description | 
|---|---|---|---|
| vendorRoots | string[] | 
transformFsSync
Transforms the directory from the file system.
transformFsSync(opts: TransformFsOptions): TransformOutput;| Parameter | Type | Description | 
|---|---|---|
| opts | TransformFsOptions | 
Returns:
TransformModule
export interface TransformModule| Property | Modifiers | Type | Description | 
|---|---|---|---|
| code | string | ||
| hook | HookAnalysis | null | ||
| isEntry | boolean | ||
| map | string | null | ||
| origPath | string | null | ||
| path | string | 
TransformModuleInput
export interface TransformModuleInputtransformModules
Transforms the input code string, does not access the file system.
transformModules(opts: TransformModulesOptions): Promise<TransformOutput>;| Parameter | Type | Description | 
|---|---|---|
| opts | TransformModulesOptions | 
Returns:
Promise<TransformOutput>
TransformModulesOptions
export interface TransformModulesOptions extends TransformOptionsExtends: TransformOptions
| Property | Modifiers | Type | Description | 
|---|---|---|---|
| input | TransformModuleInput[] | 
transformModulesSync
Transforms the input code string, does not access the file system.
transformModulesSync(opts: TransformModulesOptions): TransformOutput;| Parameter | Type | Description | 
|---|---|---|
| opts | TransformModulesOptions | 
Returns:
TransformOptions
export interface TransformOptions| Property | Modifiers | Type | Description | 
|---|---|---|---|
| entryStrategy? | EntryStrategy | (Optional) | |
| explicitExtensions? | boolean | (Optional) | |
| isServer? | boolean | (Optional) | |
| minify? | MinifyMode | (Optional) | |
| mode? | EmitMode | (Optional) | |
| preserveFilenames? | boolean | (Optional) | |
| regCtxName? | string[] | (Optional) | |
| rootDir? | string | (Optional) | |
| scope? | string | (Optional) | |
| sourceMaps? | boolean | (Optional) | |
| srcDir | string | ||
| stripCtxName? | string[] | (Optional) | |
| stripEventHandlers? | boolean | (Optional) | |
| stripExports? | string[] | (Optional) | |
| transpileJsx? | boolean | (Optional) | |
| transpileTs? | boolean | (Optional) | 
TransformOutput
export interface TransformOutput| Property | Modifiers | Type | Description | 
|---|---|---|---|
| diagnostics | Diagnostic[] | ||
| isJsx | boolean | ||
| isTypeScript | boolean | ||
| modules | TransformModule[] | 
TranspileOption
export type TranspileOption = boolean | undefined | null;versions
versions: {
  qwik: string;
}