l0.DependencyControl.PackageRecord¶
PackageRecord ¶
DependencyControl record representing one managed or unmanaged script/module.
Constructor ¶
Creates a DependencyControl record from explicit arguments and/or script globals.
| param | type | description |
|---|---|---|
| args | PackageRecordArgs |
Instance methods¶
loadConfig ¶
Loads this record's script/module configuration hive.
| param | type | description |
|---|---|---|
| importRecord? | boolean |
Overwrite this record's fields from the stored config (default false). |
Returns:
shouldWriteConfigboolean
writeConfig ¶
Writes this record's persisted fields to the shared config file.
getVersionNumber ¶
Deprecated — Use
SemanticVersion.toPacked.
Converts a version to its packed-integer form, defaulting to this record's version.
| param | type | description |
|---|---|---|
| value? | number|string |
Version to convert (default: this record's version). |
Returns:
versionNumbernumber? — nil on an invalid version string.errstring?
getVersionString ¶
Deprecated — Use
SemanticVersion.toString.
Converts a version to its string form, defaulting to this record's version.
| param | type | description |
|---|---|---|
| version? | number|string |
Version to convert (default: this record's version). |
Returns:
versionStringstring? — nil on an invalid version.errstring?
getConfigFileName ¶
Resolves this record's external config file path. Config files share one directory so they stay discoverable to other scripts through the DependencyControl config file.
Returns:
pathstring
getConfigHandler ¶
Creates a ConfigView for this record's script-specific config file.
| param | type | description |
|---|---|---|
| defaults? | table |
Default values for the config. |
| section? | string|string[] |
Config section path. |
| noLoad? | boolean |
Skip loading the file immediately. |
Returns:
getLogger ¶
Creates a logger preconfigured for this record.
| param | type | description |
|---|---|---|
| args? | table |
Logger options; missing fields are filled from this record's config. |
Returns:
getFileCache ¶
Returns a shared, persistent on-disk cache for this script, under the user's configured cache location.
It lives at <the configured cache dir>/<this script's namespace>/<name>, so each script gets its own
namespaced caches and honors the DependencyControl config. Repeated calls for the same name share one instance.
| param | type | description |
|---|---|---|
| name | string |
A short name for the cache's purpose (e.g. "thumbnails"). |
| opts? | FileCacheOptions | Default cache options; applied only when the cache is first created. |
Returns:
checkVersion ¶
Checks whether this record's version satisfies a minimum version.
| param | type | description |
|---|---|---|
| value | number|string|PackageRecord |
Version, or record, to compare against. |
| precision? | SemverPrecision | Precision to compare at (default "patch"). |
Returns:
satisfiedboolean?maskedOrErrornumber|string|nil— Masked comparison value on success, or an error message.
getSubmodules ¶
Retrieves managed submodules registered under this module namespace.
Returns:
submodulesstring[]? — Submodule namespaces, or nil for non-module records.configConfigView? — The module config section handler.
requireModules ¶
Loads or updates required modules and returns their references.
| param | type | description |
|---|---|---|
| modules? | (string|RequiredModuleSpec)[] |
Module specs to load (default: this record's requiredModules). |
| addFeeds? | string[] |
Extra feed URLs to search (default: this record's feed). |
Returns:
...any— The loaded module references, in order; an absent optional module comes back as nil.
registerTests ¶
Registers DepUnit tests for this record if test modules are available.
| param | type | description |
|---|---|---|
| ... | any |
Extra arguments forwarded to the suite's import function (see UnitTestSuite for its full signature). |
register ¶
Finalizes module registration and swaps dummy module refs for real refs. Call it in place of returning the module. Modules registered this way may depend on each other circularly, provided they don't use each other during construction.
| param | type | description |
|---|---|---|
| selfRef | table |
The module's real exported table. |
| ... | any |
Forwarded to registerTests(). |
Returns:
selfReftable
registerMacro ¶
Registers a single Aegisub macro with DependencyControl update hooks.
When the first argument is a function, name and description are taken from the script and the
remaining arguments shift left. A customMenu property in the script's config overrides the
macro's menu location; it is a user-owned setting, so scripts must not change it without consent.
| param | type | description |
|---|---|---|
| name? | string|function |
Macro name, or the process function in the short signature. |
| description? | string|function |
Macro description, or the validate function in the short signature. |
| process | function |
Macro processing callback. |
| validate? | function |
Aegisub validation callback. |
| isActive? | function |
Aegisub is-active callback. |
| submenu? | string|boolean |
Submenu name, or true to use the script name. |
registerMacros ¶
Registers multiple macros declared in table form.
| param | type | description |
|---|---|---|
| macros? | table[] |
Macro definitions, each an argument list for registerMacro. |
| submenuDefault? | string|boolean |
Default submenu value applied when a macro omits it (default true). |
| testExports? | table |
Internals to expose to this record's DepUnit test suite, forwarded to its test import function. |
setVersion ¶
Parses and sets this record's semantic version without raising on invalid input.
| param | type | description |
|---|---|---|
| version | number|string |
Returns:
versionnumber? — The parsed integer version, or nil on error.errstring?
validateNamespace ¶
Validates this record's namespace, always passing for virtual records.
Returns:
validbooleanerrstring?
getPossibleEntryPointPaths ¶
Returns all candidate entry point paths for this record under a given base directory, covering .moon and .lua extensions and init.* variants for modules.
| param | type | description |
|---|---|---|
| baseDir | string |
Absolute automation base directory. |
Returns:
pathsstring[]
getEntryPointPath ¶
Finds this record's primary entry point file, checking ?user then ?data automation directories.
Returns:
pathstring?isUserPathboolean? — True when found under ?user, false when found under ?data, nil when not found.
uninstall ¶
Uninstalls this managed record and removes matching files from automation paths.
| param | type | description |
|---|---|---|
| removeConfig? | boolean |
Also delete the record's config (default true). |
Returns:
successboolean? — nil when the record can't be uninstalled (virtual/unmanaged).resulttable|string|nil— Per-file removal results, or an error message.
Class methods¶
getRegisteredRecord ¶
Returns the live, installed record registered for a namespace, or nil if none is registered or the registered one is still a virtual (not-yet-installed) placeholder.
| param | type | description |
|---|---|---|
| namespace | string |
Returns:
recordPackageRecord?
getAllRegisteredRecords ¶
Returns all currently registered live records keyed by namespace. Includes virtual (not-yet-installed) placeholders.
Returns:
recordstable<string, PackageRecord>
checkOptionalModules ¶
Validates optional module availability for the requested feature set.
| param | type | description |
|---|---|---|
| modules | string|string[] |
Feature name(s) whose optional modules to check. |
Returns:
availablebooleanerrstring? — Error message listing missing modules.
loadGlobalConfig ¶
Loads global DependencyControl configuration.
Returns:
configConfigView
Fields¶
| field | type | description |
|---|---|---|
| semanticVersion | SemanticVersion | This record's version as a value object (the canonical store). |
| version | integer |
This record's version as a packed integer; assignable from a string, packed integer, or SemanticVersion. |
| depConf | table |
Types¶
ModuleAlias ¶
A provided-module alias: the require name this module satisfies plus optional metadata. In a
provides list a bare string is shorthand for {name = <string>}; records and feeds store the
normalized table form. version is the version of the provided module the provider satisfies
(reserved — not yet consulted during resolution, which uses the provider's own release version).
RequiredModuleSpec ¶
A required-module dependency. A bare require name is shorthand for a version-agnostic
requirement. The table form below adds a version floor and a source to fetch the module from
when it is missing.
| field | type | description |
|---|---|---|
| [1]? | string |
The module namespace (alternative to moduleName). |
| moduleName? | string |
The module namespace, as used in require. |
| version? | string|number |
Minimum version; the module must carry a compatible DependencyControl version record. |
| url? | string |
Where the module can be downloaded, shown to the user in error messages. |
| feed? | string |
Update feed used to fetch the module when it is missing. |
| optional? | boolean |
When true a missing module is not an error, but a module that is found is still version-checked. |
| name? | string |
Friendly name used in error messages. |
PackageRecordArgs ¶
Constructor arguments for a PackageRecord. All fields are optional; unset fields are filled from script_* globals (for automation scripts) or sensible defaults.
| field | type | description |
|---|---|---|
| [1]? | (string|RequiredModuleSpec)[] |
Required module specs, passed positionally. |
| moduleName? | string |
Module namespace; its presence marks this record as a module rather than an automation script. |
| name? | string |
Display name (defaults to the script/module name). |
| description? | string |
Description (defaults to script_description). |
| author? | string |
Author (defaults to script_author). |
| version? | number|string |
Semantic version (defaults to script_version). |
| namespace? | string |
Unique namespace (defaults to script_namespace). |
| url? | string |
Project or homepage URL. |
| feed? | string |
Update feed URL. |
| configFile? | string |
Config file name (defaults to " |
| virtual? | boolean |
Mark as a not-yet-installed placeholder record. |
| recordType? | RecordType | A domain.RecordType value (default Managed). |
| requiredModules? | (string|RequiredModuleSpec)[] |
Required module specs (alternative to the positional list). |
| provides? | (string|ModuleAlias)[] |
Module aliases this module satisfies for require (bare strings are normalized to ModuleAlias tables). |
| readGlobalScriptVars? | boolean |
Read script_* globals for unset fields (default true). |
| saveRecordToConfig? | boolean |
Persist this record to the config file (default true). |