API โบ @builder.io/qwik/optimizer
basename
basename(path: string, ext?: string): string;
Parameter
Type
Description
path
string
ext
string
(Optional)
string
ComponentEntryStrategy
export interface ComponentEntryStrategy
Property
Modifiers
Type
Description
Record<string, string>
(Optional)
'component'
createOptimizer
createOptimizer: (optimizerOptions?: OptimizerOptions) => Promise<Optimizer>;
Parameter
Type
Description
optimizerOptions
(Optional)
Promise<Optimizer>
Diagnostic
export interface Diagnostic
Property
Modifiers
Type
Description
string | null
string
string
string
string[] | null
DiagnosticCategory
export type DiagnosticCategory = "error" | "warning" | "sourceError";
dirname
dirname(path: string): string;
Parameter
Type
Description
path
string
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
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; }
string
GlobalInjections
export interface GlobalInjections
Property
Modifiers
Type
Description
{ [key: string]: string; }
(Optional)
'head' | 'body'
string
HookAnalysis
export interface HookAnalysis
Property
Modifiers
Type
Description
string
boolean
'event' | 'function'
string
string
string | null
string
string
[number, number]
string
string
string | null
HookEntryStrategy
export interface HookEntryStrategy
Property
Modifiers
Type
Description
Record<string, string>
(Optional)
'hook'
InlineEntryStrategy
export interface InlineEntryStrategy
Property
Modifiers
Type
Description
'inline'
InsightManifest
export interface InsightManifest
Property
Modifiers
Type
Description
Record<string, string>
{ route: string; symbols: string[]; }[]
'smart'
isAbsolute
isAbsolute(path: string): boolean;
Parameter
Type
Description
path
string
boolean
join
join(...paths: string[]): string;
Parameter
Type
Description
paths
string[]
string
MinifyMode
export type MinifyMode = "simplify" | "none";
normalize
normalize(path: string): string;
Parameter
Type
Description
path
string
string
Optimizer
export interface Optimizer
Property
Modifiers
Type
Description
Optimizer system use. This can be updated with a custom file system.
Method
Description
Transforms the directory from the file system.
Transforms the directory from the file system.
Transforms the input code string, does not access the file system.
Transforms the input code string, does not access the file system.
OptimizerOptions
export interface OptimizerOptions
Property
Modifiers
Type
Description
any
(Optional)
number
(Optional) Inline the global styles if they're smaller than this
boolean
(Optional) Enable sourcemaps
(Optional)
OptimizerSystem
export interface OptimizerSystem
Property
Modifiers
Type
Description
() => string
(path: string) => Promise<any>
(rootDir: string) => Promise<TransformModuleInput[]>
(Optional)
string
(path: string) => Promise<any>
parse
parse(path: string): {
root: string;
dir: string;
base: string;
ext: string;
name: string;
};
Parameter
Type
Description
path
string
{ root: string; dir: string; base: string; ext: string; name: string; }
Path
export interface Path
Property
Modifiers
Type
Description
readonly
string
readonly
readonly
string
readonly
null
Method
Description
QwikBuildMode
export type QwikBuildMode = "production" | "development";
QwikBuildTarget
export type QwikBuildTarget = "client" | "ssr" | "lib" | "test";
QwikBundle
export interface QwikBundle
Property
Modifiers
Type
Description
string[]
(Optional)
string[]
(Optional)
string[]
(Optional)
number
string[]
(Optional)
QwikManifest
export interface QwikManifest
Property
Modifiers
Type
Description
{ [fileName: string]: QwikBundle; }
(Optional)
string
{ [symbolName: string]: string; }
{ target?: string; buildMode?: string; entryStrategy?: { [key: string]: any; }; }
(Optional)
{ [name: string]: string; }
(Optional)
{ [symbolName: string]: QwikSymbol; }
string
qwikRollup
export declare function qwikRollup(
qwikRollupOpts?: QwikRollupPluginOptions,
): any;
Parameter
Type
Description
qwikRollupOpts
(Optional)
any
QwikRollupPluginOptions
export interface QwikRollupPluginOptions
Property
Modifiers
Type
Description
(Optional) Build production
or development
.
Default development
boolean
(Optional)
boolean
(Optional) Prints verbose Qwik plugin debug logs.
Default false
(Optional) The Qwik entry strategy to use while building for production. During development the type is always hook
.
Default { type: "smart" }
)
boolean
(Optional) Run eslint on the source files for the ssr build or dev server. This can slow down startup on large projects. Defaults to true
(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
(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
(Optional)
string
(Optional) The root of the application, which is commonly the same directory as package.json
and rollup.config.js
.
Default process.cwd()
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
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
(Optional) Target client
or ssr
.
Default client
((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
string
boolean
'function' | 'event'
string
string
string
[number, number]
string
string | null
qwikVite
export declare function qwikVite(qwikViteOpts?: QwikVitePluginOptions): any;
Parameter
Type
Description
qwikViteOpts
(Optional)
any
QwikViteDevResponse
export interface QwikViteDevResponse
Property
Modifiers
Type
Description
Record<string, any>
(Optional)
() => void
(Optional)
QwikVitePlugin
export interface QwikVitePlugin
Property
Modifiers
Type
Description
'vite-plugin-qwik'
QwikVitePluginApi
export interface QwikVitePluginApi
Property
Modifiers
Type
Description
() => string | null
() => string | null
(clientOutDir?: string | null) => Promise<InsightManifest | null>
() => QwikManifest | null
() => Optimizer | null
() => NormalizedQwikPluginOptions
() => string | null
QwikVitePluginOptions
export type QwikVitePluginOptions =
| QwikVitePluginCSROptions
| QwikVitePluginSSROptions;
relative
relative(from: string, to: string): string;
Parameter
Type
Description
from
string
to
string
string
resolve
resolve(...paths: string[]): string;
Parameter
Type
Description
paths
string[]
string
ResolvedManifest
export interface ResolvedManifest
Property
Modifiers
Type
Description
SingleEntryStrategy
export interface SingleEntryStrategy
Property
Modifiers
Type
Description
Record<string, string>
(Optional)
'single'
SmartEntryStrategy
export interface SmartEntryStrategy
Property
Modifiers
Type
Description
Record<string, string>
(Optional)
'smart'
SourceLocation
export interface SourceLocation
Property
Modifiers
Type
Description
number
number
number
number
number
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
Promise<TransformOutput>
TransformFsOptions
export interface TransformFsOptions extends TransformOptions
Extends: TransformOptions
Property
Modifiers
Type
Description
string[]
transformFsSync
Transforms the directory from the file system.
transformFsSync(opts: TransformFsOptions): TransformOutput;
Parameter
Type
Description
opts
TransformModule
export interface TransformModule
Property
Modifiers
Type
Description
string
HookAnalysis | null
boolean
string | null
string | null
string
TransformModuleInput
export interface TransformModuleInput
Property
Modifiers
Type
Description
string
string
transformModules
Transforms the input code string, does not access the file system.
transformModules(opts: TransformModulesOptions): Promise<TransformOutput>;
Parameter
Type
Description
opts
Promise<TransformOutput>
TransformModulesOptions
export interface TransformModulesOptions extends TransformOptions
Extends: TransformOptions
Property
Modifiers
Type
Description
transformModulesSync
Transforms the input code string, does not access the file system.
transformModulesSync(opts: TransformModulesOptions): TransformOutput;
Parameter
Type
Description
opts
TransformOptions
export interface TransformOptions
Property
Modifiers
Type
Description
(Optional)
boolean
(Optional)
boolean
(Optional)
(Optional)
EmitMode
(Optional)
boolean
(Optional)
string[]
(Optional)
string
(Optional)
string
(Optional)
boolean
(Optional)
string
string[]
(Optional)
boolean
(Optional)
string[]
(Optional)
boolean
(Optional)
boolean
(Optional)
TransformOutput
export interface TransformOutput
Property
Modifiers
Type
Description
boolean
boolean
TranspileOption
export type TranspileOption = boolean | undefined | null;
versions
versions: {
qwik: string;
}