module_helpers.ts

Declarations
#

Module path and metadata helpers.

Provides utilities for working with source module paths, file types, and import relationships in the package generation system.

All functions are prefixed with module_ for clarity.

11 declarations

view source

module_extract_path
#

module_helpers.ts view source

(source_id: string): string

Extract module path relative to src/lib from absolute source ID.

source_id

type string

returns

string

examples

Example 1

module_get_component_name
#

module_helpers.ts view source

(module_path: string): string

Extract component name from a Svelte module path.

module_path

type string

returns

string

examples

Example 1

module_get_key
#

module_helpers.ts view source

(module_path: string): string

Convert module path to module key format (with ./ prefix).

module_path

type string

returns

string

examples

Example 1

module_is_css
#

module_is_json
#

module_is_svelte
#

module_is_test
#

module_is_typescript
#

module_matches_source
#

module_helpers.ts view source

(path: string, options?: ModuleSourceOptions | undefined): boolean

Check if a path matches source criteria.

Checks source directory paths, file extensions, and exclusion patterns. Uses defaults if no options provided.

Rejects nested repo paths by ensuring the first /src/ leads to the source directory (e.g. rejects /src/fixtures/repos/foo/src/lib/index.ts because /src/fixtures//src/lib/).

path

Full path to check

type string

options?

Configuration options (uses defaults if not provided)

type ModuleSourceOptions | undefined
optional

returns

boolean

True if the path matches all criteria

MODULE_SOURCE_DEFAULTS
#

ModuleSourceOptions
#

module_helpers.ts view source

ModuleSourceOptions

Configuration for module source detection.

Allows customizing which paths are considered source modules, useful for projects with non-standard directory structures.

source_paths

Source directory paths to include.

type Array<string>

extensions

File extensions to analyze.

type Array<string>

exclude_patterns

Patterns to exclude (matched against full path).

type Array<RegExp>

Imported by
#