API › @builder.io/qwik/optimizer

basename

basename(path: string, ext?: string): string;

パラメータ

説明

path

string

ext

string

(オプション)

string

ComponentEntryStrategy

export interface ComponentEntryStrategy

プロパティ

修飾子

説明

manual?

Record<string, string>

(オプション)

type

'component'

このセクションを編集

createOptimizer

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

パラメータ

説明

optimizerOptions

OptimizerOptions

(オプション)

Promise<Optimizer>

このセクションを編集

Diagnostic

export interface Diagnostic

プロパティ

修飾子

説明

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;

パラメータ

説明

path

string

string

EntryStrategy

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

参照: InlineEntryStrategySingleEntryStrategyHookEntryStrategyComponentEntryStrategySmartEntryStrategy

このセクションを編集

extname

extname(path: string): string;

パラメータ

説明

path

string

string

format

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

パラメータ

説明

pathObject

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

string

GlobalInjections

export interface GlobalInjections

プロパティ

修飾子

説明

attributes?

{ [key: string]: string; }

(オプション)

location

'head' | 'body'

tag

string

このセクションを編集

HookAnalysis

export interface HookAnalysis

プロパティ

修飾子

説明

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 HookEntryStrategy

プロパティ

修飾子

説明

manual?

Record<string, string>

(オプション)

type

'hook'

このセクションを編集

InlineEntryStrategy

export interface InlineEntryStrategy

プロパティ

修飾子

説明

type

'inline'

このセクションを編集

InsightManifest

export interface InsightManifest

プロパティ

修飾子

説明

manual

Record<string, string>

prefetch

{ route: string; symbols: string[]; }[]

type

'smart'

このセクションを編集

isAbsolute

isAbsolute(path: string): boolean;

パラメータ

説明

path

string

boolean

join

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

パラメータ

説明

paths

string[]

string

MinifyMode

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

このセクションを編集

normalize

normalize(path: string): string;

パラメータ

説明

path

string

string

Optimizer

export interface Optimizer

プロパティ

修飾子

説明

sys

OptimizerSystem

オプティマイザシステムの使用。これはカスタムファイルシステムで更新できます。

メソッド

説明

transformFs(opts)

ファイルシステムからディレクトリを変換します。

transformFsSync(opts)

ファイルシステムからディレクトリを変換します。

transformModules(opts)

入力コード文字列を変換し、ファイルシステムにアクセスしません。

transformModulesSync(opts)

入力コード文字列を変換し、ファイルシステムにアクセスしません。

このセクションを編集

OptimizerOptions

export interface OptimizerOptions

プロパティ

修飾子

説明

binding?

any

(オプション)

inlineStylesUpToBytes?

number

(オプション) グローバルスタイルがこれより小さい場合はインライン化します

sourcemap?

boolean

(オプション) ソースマップを有効にする

sys?

OptimizerSystem

(オプション)

このセクションを編集

OptimizerSystem

export interface OptimizerSystem

プロパティ

修飾子

説明

cwd

() => string

dynamicImport

(path: string) => Promise<any>

env

SystemEnvironment

getInputFiles?

(rootDir: string) => Promise<TransformModuleInput[]>

(オプション)

os

string

path

Path

strictDynamicImport

(path: string) => Promise<any>

このセクションを編集

parse

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

パラメータ

説明

path

string

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

Path

export interface Path

プロパティ

修飾子

説明

delimiter

readonly

string

posix

readonly

Path

sep

readonly

string

win32

readonly

null

メソッド

説明

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

プロパティ

修飾子

説明

dynamicImports?

string[]

(オプション)

imports?

string[]

(オプション)

origins?

string[]

(オプション)

size

number

symbols?

string[]

(オプション)

このセクションを編集

QwikManifest

ビルドのメタデータ。その用途の1つは、QRLシンボルがどこにあるかを保存することです。

export interface QwikManifest

プロパティ

修飾子

説明

bundles

{ [fileName: string]: QwikBundle; }

すべてのコードバンドル。インポートグラフを知るために使用されます

injections?

GlobalInjections[]

(オプション) ドキュメントのheadに挿入するCSSなど

manifestHash

string

マニフェストのコンテンツハッシュ。これが変更された場合、コードが変更されました

mapping

{ [symbolName: string]: string; }

QRLの場所

options?

{ target?: string; buildMode?: string; entryStrategy?: { [key: string]: any; }; }

(オプション)

platform?

{ [name: string]: string; }

(オプション)

symbols

{ [symbolName: string]: QwikSymbol; }

QRLシンボル

version

string

このセクションを編集

qwikRollup

export declare function qwikRollup(
  qwikRollupOpts?: QwikRollupPluginOptions,
): any;

パラメータ

説明

qwikRollupOpts

QwikRollupPluginOptions

(オプション)

any

このセクションを編集

QwikRollupPluginOptions

export interface QwikRollupPluginOptions

プロパティ

修飾子

説明

buildMode?

QwikBuildMode

(オプション) productionまたはdevelopmentをビルドします。

デフォルトはdevelopment

csr?

boolean

(オプション)

debug?

boolean

(オプション) 詳細なQwikプラグインデバッグログを出力します。

デフォルトはfalse

entryStrategy?

EntryStrategy

(オプション) 本番ビルドで使用するQwikエントリ戦略。開発中は、型は常にhookです。

デフォルトは{ type: "smart" }

lint?

boolean

(オプション) SSRビルドまたは開発サーバーのソースファイルに対してeslintを実行します。これにより、大規模プロジェクトでの起動が遅くなる可能性があります。デフォルトはtrue

manifestInput?

QwikManifest

(オプション) SSRビルドでは、クライアントビルド中に生成されたマニフェストが必要です。manifestInputオプションを使用すると、マニフェストを手動で提供できます。

デフォルトはundefined

manifestOutput?

(manifest: QwikManifest) => Promise<void> | void

(オプション) クライアントビルドはマニフェストを作成し、このフックが生成されたビルドデータで呼び出されます。

デフォルトはundefined

optimizerOptions?

OptimizerOptions

(オプション)

rootDir?

string

(オプション) アプリケーションのルート。これは通常、package.jsonおよびrollup.config.jsと同じディレクトリです。

デフォルトはprocess.cwd()

srcDir?

string

(オプション) すべてのQwikコンポーネントを見つけるためのソースディレクトリ。Qwikには単一の入力がないため、srcDirを使用してQwikファイルを再帰的に検索します。

デフォルトはsrc

srcInputs?

TransformModuleInput[] | null

(オプション) srcDir の代替として、srcInputs でファイルをマニュアルで指定できます。このオプションは、ウェブワーカーなど、ファイルシステムがない環境で役立ちます。

デフォルト: null

target?

QwikBuildTarget

(オプション) 対象を client または ssr に設定します。

デフォルト: client

transformedModuleOutput?

((transformedModules: TransformModule[]) => Promise<void> | void) | null

(オプション) ビルド後に呼び出され、バンドル前に使用されたすべての変換済みモジュールを提供するフックです。

このセクションを編集

QwikSymbol

export interface QwikSymbol

プロパティ

修飾子

説明

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;

パラメータ

説明

qwikViteOpts

QwikVitePluginOptions

(オプション)

any

このセクションを編集

QwikViteDevResponse

export interface QwikViteDevResponse

プロパティ

修飾子

説明

_qwikEnvData?

Record<string, any>

(オプション)

_qwikRenderResolve?

() => void

(オプション)

このセクションを編集

QwikVitePlugin

export interface QwikVitePlugin

プロパティ

修飾子

説明

api

QwikVitePluginApi

name

'vite-plugin-qwik'

このセクションを編集

QwikVitePluginApi

export interface QwikVitePluginApi

プロパティ

修飾子

説明

getAssetsDir

() => string | undefined

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;

パラメータ

説明

from

string

to

string

string

resolve

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

パラメータ

説明

paths

string[]

string

ResolvedManifest

export interface ResolvedManifest

プロパティ

修飾子

説明

manifest

QwikManifest

mapper

SymbolMapper

このセクションを編集

SingleEntryStrategy

export interface SingleEntryStrategy

プロパティ

修飾子

説明

manual?

Record<string, string>

(オプション)

type

'single'

このセクションを編集

SmartEntryStrategy

export interface SmartEntryStrategy

プロパティ

修飾子

説明

manual?

Record<string, string>

(オプション)

type

'smart'

このセクションを編集

SourceLocation

export interface SourceLocation

プロパティ

修飾子

説明

endCol

number

endLine

number

hi

number

lo

number

startCol

number

startLine

number

このセクションを編集

SourceMapsOption

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

このセクションを編集

symbolMapper

このAPIは開発者向けのアルファプレビューとして提供されており、フィードバックに基づいて変更される可能性があります。本番環境ではこのAPIを使用しないでください。

特定のシンボル (onKeydown$ のような QRL) について、サーバーはシンボルがどのバンドルに含まれているかを知る必要があります。

通常、これは Qwik の q-manifest によって提供されます。ただし、q-manifest はクライアントのフルビルド後にのみ存在します。

これは開発モードでは問題になります。そのため、開発モードでは、以下の symbolMapper 関数を使用してシンボルが予想される URL にマッピングされます。Vite の場合、指定されたパスは特定のシンボルに対して固定されます。

symbolMapper: ReturnType<typeof createSymbolMapper>;

このセクションを編集

SymbolMapper

このAPIは開発者向けのアルファプレビューとして提供されており、フィードバックに基づいて変更される可能性があります。本番環境ではこのAPIを使用しないでください。

特定のシンボル (onKeydown$ のような QRL) について、サーバーはシンボルがどのバンドルに含まれているかを知る必要があります。

通常、これは Qwik の q-manifest によって提供されます。ただし、q-manifest はクライアントのフルビルド後にのみ存在します。

これは開発モードでは問題になります。そのため、開発モードでは、以下の symbolMapper 関数を使用してシンボルが予想される URL にマッピングされます。Vite の場合、指定されたパスは特定のシンボルに対して固定されます。

symbolMapper: ReturnType<typeof createSymbolMapper>;

このセクションを編集

SymbolMapperFn

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

参照: SymbolMapper

このセクションを編集

SystemEnvironment

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

このセクションを編集

transformFs

ファイルシステムからディレクトリを変換します。

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

パラメータ

説明

opts

TransformFsOptions

Promise<TransformOutput>

TransformFsOptions

export interface TransformFsOptions extends TransformOptions

拡張: TransformOptions

プロパティ

修飾子

説明

vendorRoots

string[]

このセクションを編集

transformFsSync

ファイルシステムからディレクトリを変換します。

transformFsSync(opts: TransformFsOptions): TransformOutput;

パラメータ

説明

opts

TransformFsOptions

TransformOutput

TransformModule

export interface TransformModule

プロパティ

修飾子

説明

code

string

hook

HookAnalysis | null

isEntry

boolean

map

string | null

origPath

string | null

path

string

このセクションを編集

TransformModuleInput

export interface TransformModuleInput

プロパティ

修飾子

説明

code

string

path

string

このセクションを編集

transformModules

入力コード文字列を変換し、ファイルシステムにアクセスしません。

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

パラメータ

説明

opts

TransformModulesOptions

Promise<TransformOutput>

TransformModulesOptions

export interface TransformModulesOptions extends TransformOptions

拡張: TransformOptions

プロパティ

修飾子

説明

input

TransformModuleInput[]

このセクションを編集

transformModulesSync

入力コード文字列を変換し、ファイルシステムにアクセスしません。

transformModulesSync(opts: TransformModulesOptions): TransformOutput;

パラメータ

説明

opts

TransformModulesOptions

TransformOutput

TransformOptions

export interface TransformOptions

プロパティ

修飾子

説明

entryStrategy?

EntryStrategy

(オプション)

explicitExtensions?

boolean

(オプション)

isServer?

boolean

(オプション)

minify?

MinifyMode

(オプション)

mode?

EmitMode

(オプション)

preserveFilenames?

boolean

(オプション)

regCtxName?

string[]

(オプション)

rootDir?

string

(オプション)

scope?

string

(オプション)

sourceMaps?

boolean

(オプション)

srcDir

string

stripCtxName?

string[]

(オプション)

stripEventHandlers?

boolean

(オプション)

stripExports?

string[]

(オプション)

transpileJsx?

boolean

(オプション)

transpileTs?

boolean

(オプション)

このセクションを編集

TransformOutput

export interface TransformOutput

プロパティ

修飾子

説明

diagnostics

Diagnostic[]

isJsx

boolean

isTypeScript

boolean

modules

TransformModule[]

このセクションを編集

TranspileOption

export type TranspileOption = boolean | undefined | null;

このセクションを編集

versions

versions: {
  qwik: string;
}

このセクションを編集