API โ€บ @builder.io/qwik/optimizer

basename

basename(path: string, ext?: string): string;
ParameterTypeDescription
pathstring
extstring(Optional)

Returns:

string

ComponentEntryStrategy

export interface ComponentEntryStrategy
PropertyModifiersTypeDescription
manual?Record<string, string>(Optional)
type'component'

Edit this section

createOptimizer

createOptimizer: (optimizerOptions?: OptimizerOptions) => Promise<Optimizer>;

Edit this section

Diagnostic

export interface Diagnostic
PropertyModifiersTypeDescription
categoryDiagnosticCategory
codestring | null
filestring
highlightsSourceLocation[]
messagestring
scopestring
suggestionsstring[] | null

Edit this section

DiagnosticCategory

export type DiagnosticCategory = "error" | "warning" | "sourceError";

Edit this section

dirname

dirname(path: string): string;
ParameterTypeDescription
pathstring

Returns:

string

EntryStrategy

export type EntryStrategy =
  | InlineEntryStrategy
  | HoistEntryStrategy
  | SingleEntryStrategy
  | HookEntryStrategy
  | ComponentEntryStrategy
  | SmartEntryStrategy;

References: InlineEntryStrategy, SingleEntryStrategy, HookEntryStrategy, ComponentEntryStrategy, SmartEntryStrategy

Edit this section

extname

extname(path: string): string;
ParameterTypeDescription
pathstring

Returns:

string

format

format(pathObject: {
        root: string;
        dir: string;
        base: string;
        ext: string;
        name: string;
    }): string;
ParameterTypeDescription
pathObject{ root: string; dir: string; base: string; ext: string; name: string; }

Returns:

string

GlobalInjections

export interface GlobalInjections
PropertyModifiersTypeDescription
attributes?{ [key: string]: string; }(Optional)
location'head' | 'body'
tagstring

Edit this section

HookAnalysis

export interface HookAnalysis
PropertyModifiersTypeDescription
canonicalFilenamestring
capturesboolean
ctxKind'event' | 'function'
ctxNamestring
displayNamestring
entrystring | null
extensionstring
hashstring
namestring
originstring
parentstring | null

Edit this section

HookEntryStrategy

export interface HookEntryStrategy
PropertyModifiersTypeDescription
manual?Record<string, string>(Optional)
type'hook'

Edit this section

InlineEntryStrategy

export interface InlineEntryStrategy
PropertyModifiersTypeDescription
type'inline'

Edit this section

isAbsolute

isAbsolute(path: string): boolean;
ParameterTypeDescription
pathstring

Returns:

boolean

join

join(...paths: string[]): string;
ParameterTypeDescription
pathsstring[]

Returns:

string

MinifyMode

export type MinifyMode = "simplify" | "none";

Edit this section

normalize

normalize(path: string): string;
ParameterTypeDescription
pathstring

Returns:

string

Optimizer

export interface Optimizer
PropertyModifiersTypeDescription
sysOptimizerSystemOptimizer system use. This can be updated with a custom file system.
MethodDescription
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.

Edit this section

OptimizerOptions

export interface OptimizerOptions
PropertyModifiersTypeDescription
binding?any(Optional)
sys?OptimizerSystem(Optional)

Edit this section

OptimizerSystem

export interface OptimizerSystem
PropertyModifiersTypeDescription
cwd() => string
dynamicImport(path: string) => Promise<any>
envSystemEnvironment
getInputFiles?(rootDir: string) => Promise<TransformModuleInput[]>(Optional)
osstring
pathPath
strictDynamicImport(path: string) => Promise<any>

Edit this section

parse

parse(path: string): {
        root: string;
        dir: string;
        base: string;
        ext: string;
        name: string;
    };
ParameterTypeDescription
pathstring

Returns:

{ root: string; dir: string; base: string; ext: string; name: string; }

Path

export interface Path
PropertyModifiersTypeDescription
delimiterreadonlystring
posixreadonlyPath
sepreadonlystring
win32readonlynull

Edit this section

QwikBuildMode

export type QwikBuildMode = "production" | "development";

Edit this section

QwikBuildTarget

export type QwikBuildTarget = "client" | "ssr" | "lib" | "test";

Edit this section

QwikBundle

export interface QwikBundle
PropertyModifiersTypeDescription
dynamicImports?string[](Optional)
imports?string[](Optional)
origins?string[](Optional)
sizenumber
symbols?string[](Optional)

Edit this section

QwikManifest

export interface QwikManifest
PropertyModifiersTypeDescription
bundles{ [fileName: string]: QwikBundle; }
injections?GlobalInjections[](Optional)
mapping{ [symbolName: string]: string; }
options?{ target?: string; buildMode?: string; entryStrategy?: { [key: string]: any; }; }(Optional)
platform?{ [name: string]: string; }(Optional)
symbols{ [symbolName: string]: QwikSymbol; }
versionstring

Edit this section

qwikRollup

export declare function qwikRollup(
  qwikRollupOpts?: QwikRollupPluginOptions
): any;
ParameterTypeDescription
qwikRollupOptsQwikRollupPluginOptions(Optional)

Returns:

any

Edit this section

QwikRollupPluginOptions

export interface QwikRollupPluginOptions
PropertyModifiersTypeDescription
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" })
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.

Edit this section

QwikSymbol

export interface QwikSymbol
PropertyModifiersTypeDescription
canonicalFilenamestring
capturesboolean
ctxKind'function' | 'event'
ctxNamestring
displayNamestring
hashstring
originstring
parentstring | null

Edit this section

qwikVite

export declare function qwikVite(qwikViteOpts?: QwikVitePluginOptions): any;
ParameterTypeDescription
qwikViteOptsQwikVitePluginOptions(Optional)

Returns:

any

Edit this section

QwikViteDevResponse

export interface QwikViteDevResponse
PropertyModifiersTypeDescription
_qwikEnvData?Record<string, any>(Optional)
_qwikRenderResolve?() => void(Optional)

Edit this section

QwikVitePlugin

export interface QwikVitePlugin
PropertyModifiersTypeDescription
apiQwikVitePluginApi
name'vite-plugin-qwik'

Edit this section

QwikVitePluginApi

export interface QwikVitePluginApi
PropertyModifiersTypeDescription
getClientOutDir() => string | null
getClientPublicOutDir() => string | null
getManifest() => QwikManifest | null
getOptimizer() => Optimizer | null
getOptions() => NormalizedQwikPluginOptions
getRootDir() => string | null

Edit this section

QwikVitePluginOptions

export interface QwikVitePluginOptions
PropertyModifiersTypeDescription
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 []

Edit this section

relative

relative(from: string, to: string): string;
ParameterTypeDescription
fromstring
tostring

Returns:

string

resolve

resolve(...paths: string[]): string;
ParameterTypeDescription
pathsstring[]

Returns:

string

ResolvedManifest

export interface ResolvedManifest
PropertyModifiersTypeDescription
manifestQwikManifest
mapperSymbolMapper

Edit this section

SingleEntryStrategy

export interface SingleEntryStrategy
PropertyModifiersTypeDescription
manual?Record<string, string>(Optional)
type'single'

Edit this section

SmartEntryStrategy

export interface SmartEntryStrategy
PropertyModifiersTypeDescription
manual?Record<string, string>(Optional)
type'smart'

Edit this section

SourceLocation

export interface SourceLocation
PropertyModifiersTypeDescription
endColnumber
endLinenumber
hinumber
lonumber
startColnumber
startLinenumber

Edit this section

SourceMapsOption

export type SourceMapsOption = "external" | "inline" | undefined | null;

Edit this section

SymbolMapper

export type SymbolMapper = Record<
  string,
  readonly [symbol: string, chunk: string]
>;

Edit this section

SymbolMapperFn

export type SymbolMapperFn = (
  symbolName: string,
  mapper: SymbolMapper | undefined
) => readonly [symbol: string, chunk: string] | undefined;

References: SymbolMapper

Edit this section

SystemEnvironment

export type SystemEnvironment =
  | "node"
  | "deno"
  | "webworker"
  | "browsermain"
  | "unknown";

Edit this section

transformFs

Transforms the directory from the file system.

transformFs(opts: TransformFsOptions): Promise<TransformOutput>;
ParameterTypeDescription
optsTransformFsOptions

Returns:

Promise<TransformOutput>

TransformFsOptions

export interface TransformFsOptions extends TransformOptions

Extends: TransformOptions

PropertyModifiersTypeDescription
vendorRootsstring[]

Edit this section

transformFsSync

Transforms the directory from the file system.

transformFsSync(opts: TransformFsOptions): TransformOutput;
ParameterTypeDescription
optsTransformFsOptions

Returns:

TransformOutput

TransformModule

export interface TransformModule
PropertyModifiersTypeDescription
codestring
hookHookAnalysis | null
isEntryboolean
mapstring | null
pathstring

Edit this section

TransformModuleInput

export interface TransformModuleInput
PropertyModifiersTypeDescription
codestring
pathstring

Edit this section

transformModules

Transforms the input code string, does not access the file system.

transformModules(opts: TransformModulesOptions): Promise<TransformOutput>;
ParameterTypeDescription
optsTransformModulesOptions

Returns:

Promise<TransformOutput>

TransformModulesOptions

export interface TransformModulesOptions extends TransformOptions

Extends: TransformOptions

PropertyModifiersTypeDescription
inputTransformModuleInput[]

Edit this section

transformModulesSync

Transforms the input code string, does not access the file system.

transformModulesSync(opts: TransformModulesOptions): TransformOutput;
ParameterTypeDescription
optsTransformModulesOptions

Returns:

TransformOutput

TransformOptions

export interface TransformOptions
PropertyModifiersTypeDescription
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)
srcDirstring
stripCtxName?string[](Optional)
stripEventHandlers?boolean(Optional)
stripExports?string[](Optional)
transpileJsx?boolean(Optional)
transpileTs?boolean(Optional)

Edit this section

TransformOutput

export interface TransformOutput
PropertyModifiersTypeDescription
diagnosticsDiagnostic[]
isJsxboolean
isTypeScriptboolean
modulesTransformModule[]

Edit this section

TranspileOption

export type TranspileOption = boolean | undefined | null;

Edit this section

versions

versions: {
  qwik: string;
}

Edit this section