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 ComponentEntryStrategy
createOptimizer
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 | ||
name | string | ||
origin | string | ||
parent | string | null |
HookEntryStrategy
export interface HookEntryStrategy
Property | Modifiers | Type | Description |
---|---|---|---|
type | 'hook' |
InlineEntryStrategy
export interface InlineEntryStrategy
Property | Modifiers | Type | Description |
---|---|---|---|
type | 'inline' |
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) | |
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) | |
mapping | { [symbolName: string]: string; } | ||
options? | { target?: string; buildMode?: string; forceFullBuild?: boolean; 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 | |
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" }) | |
forceFullBuild? | boolean | (Optional) | |
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 | ||
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 | ||
getManifest | () => QwikManifest | null | ||
getOptimizer | () => Optimizer | null | ||
getOptions | () => NormalizedQwikPluginOptions | ||
getRootDir | () => string | null |
QwikVitePluginOptions
export interface QwikVitePluginOptions
Property | Modifiers | Type | Description |
---|---|---|---|
client? | { input?: string[] | string; devInput?: string; outDir?: string; manifestOutput?: (manifest: QwikManifest) => Promise<void> | void; } | (Optional) | |
debug? | boolean | (Optional) Prints verbose Qwik plugin debug logs. Default false | |
devTools? | { clickToSource: string[] | false; } | (Optional) | |
entryStrategy? | EntryStrategy | (Optional) The Qwik entry strategy to use while building for production. During development the type is always hook. Default { type: "smart" }) | |
optimizerOptions? | OptimizerOptions | (Optional) Options for the Qwik optimizer. Default undefined | |
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 | |
ssr? | { input?: string; outDir?: string; manifestInput?: QwikManifest; } | (Optional) | |
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. | |
vendorRoots? | string[] | (Optional) List of directories to recursively search for Qwik components or Vendors. Default [] |
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 SingleEntryStrategy
SmartEntryStrategy
export interface SmartEntryStrategy
SourceLocation
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"
| "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 TransformOptions
Extends: 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 | ||
path | string |
TransformModuleInput
export interface TransformModuleInput
transformModules
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 TransformOptions
Extends: 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;
}