Skip to main content

@lexical/compiler/SubpathImports

Interfaces

SubpathImportsOptions

Defined in: packages/lexical-compiler/src/SubpathImports.ts:13

Properties

packages?

optional packages?: readonly string[]

Defined in: packages/lexical-compiler/src/SubpathImports.ts:15

Package names or paths to package.json files. Defaults to ['@lexical/extension'].

parserPlugins?

optional parserPlugins?: readonly unknown[]

Defined in: packages/lexical-compiler/src/SubpathImports.ts:17

Extra @babel/parser plugins, for syntax the defaults do not cover.

root?

optional root?: string

Defined in: packages/lexical-compiler/src/SubpathImports.ts:19

Resolve package names from this directory. Defaults to process.cwd().

strict?

optional strict?: boolean

Defined in: packages/lexical-compiler/src/SubpathImports.ts:21

Reject runtime barrel access that cannot be narrowed (namespace, dynamic, require, side-effect or star imports). Defaults to false.


SubpathImportsPlugin

Defined in: packages/lexical-compiler/src/SubpathImports.ts:25

Structural interface compatible with Rollup and Vite, without a runtime dependency on either.

Properties

enforce

enforce: "pre"

Defined in: packages/lexical-compiler/src/SubpathImports.ts:27

name

name: string

Defined in: packages/lexical-compiler/src/SubpathImports.ts:26

Methods

buildStart()

buildStart(this): void

Defined in: packages/lexical-compiler/src/SubpathImports.ts:28

Parameters
this
addWatchFile
Returns

void

handleHotUpdate()

handleHotUpdate<Module>(context): void | Module[]

Defined in: packages/lexical-compiler/src/SubpathImports.ts:29

Type Parameters
Module

Module

Parameters
context
file

string

modules

Module[]

server

{ moduleGraph: { getModuleById: Module | undefined; invalidateModule: void; }; watcher: { add: unknown; }; }

server.moduleGraph

{ getModuleById: Module | undefined; invalidateModule: void; }

server.moduleGraph.getModuleById
server.moduleGraph.invalidateModule
server.watcher

{ add: unknown; }

server.watcher.add
timestamp

number

Returns

void | Module[]

shouldTransformCachedModule()

shouldTransformCachedModule(): boolean

Defined in: packages/lexical-compiler/src/SubpathImports.ts:46

Returns

boolean

transform()

transform(code, id): { code: string; map: SourceMap; } | null

Defined in: packages/lexical-compiler/src/SubpathImports.ts:47

Parameters
code

string

id

string

Returns

{ code: string; map: SourceMap; } | null

Variables

subpathImports

const subpathImports: (options?) => SubpathImportsPlugin = impl.subpathImports

Defined in: packages/lexical-compiler/src/SubpathImports.ts:57

Rewrite named barrel imports to public subpaths before dependency resolution.

Parameters

options?

SubpathImportsOptions

Returns

SubpathImportsPlugin