mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 03:05:38 -05:00
ts strict - getAttribute (#863)
* ts strict getAttribute * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * mark xfail * fix to string * Remove * use getAttribute for theme Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import toml from '../src/toml'
|
||||
import { getLogger } from './logger';
|
||||
import { version } from './runtime';
|
||||
import { readTextFromPath, showError } from './utils'
|
||||
import { getAttribute, readTextFromPath, showError } from './utils'
|
||||
|
||||
const logger = getLogger('py-config');
|
||||
|
||||
@@ -15,10 +15,10 @@ export interface AppConfig extends Record<string, any> {
|
||||
author_email?: string;
|
||||
license?: string;
|
||||
autoclose_loader?: boolean;
|
||||
runtimes?: Array<RuntimeConfig>;
|
||||
packages?: Array<string>;
|
||||
paths?: Array<string>;
|
||||
plugins?: Array<string>;
|
||||
runtimes?: RuntimeConfig[];
|
||||
packages?: string[];
|
||||
paths?: string[];
|
||||
plugins?: string[];
|
||||
pyscript?: PyScriptMetadata;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ export function loadConfigFromElement(el: Element): AppConfig {
|
||||
inlineConfig = {};
|
||||
}
|
||||
else {
|
||||
const configType: string = el.hasAttribute("type") ? el.getAttribute("type") : "toml";
|
||||
const configType = getAttribute(el, "type") || "toml";
|
||||
srcConfig = extractFromSrc(el, configType);
|
||||
inlineConfig = extractFromInline(el, configType);
|
||||
}
|
||||
@@ -77,9 +77,8 @@ export function loadConfigFromElement(el: Element): AppConfig {
|
||||
}
|
||||
|
||||
function extractFromSrc(el: Element, configType: string) {
|
||||
if (el.hasAttribute('src'))
|
||||
{
|
||||
const src = el.getAttribute('src');
|
||||
const src = getAttribute(el, "src")
|
||||
if (src) {
|
||||
logger.info('loading ', src)
|
||||
return validateConfig(readTextFromPath(src), configType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user