@evitcastudio/kit 1.0.2 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/cli.ts +1 -1
- package/bin/index.ts +1 -1
- package/bin/resource-builder.ts +25 -2
- package/bin/types/shared-types.ts +1 -1
- package/bun.lockb +0 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +9 -2
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/index.Kit.html +13 -12
- package/docs/index.html +1 -1
- package/docs/modules/types_shared-types.html +1 -1
- package/docs/types/types_shared-types.EmitterEvent.html +1 -1
- package/docs/types/types_shared-types.KitPluginConstructor.html +1 -0
- package/docs/types/types_shared-types.Listener.html +1 -1
- package/docs/types/types_shared-types.ResourceData.html +1 -0
- package/docs/variables/types_shared-types.VYLO.html +1 -0
- package/lib/bundle/cli/cli.js +18 -3
- package/lib/event-system.d.ts +3 -2
- package/lib/event-system.d.ts.map +1 -1
- package/lib/event-system.js +1 -0
- package/lib/kit.d.ts +15 -4
- package/lib/kit.d.ts.map +1 -1
- package/lib/kit.js +62 -0
- package/lib/types/shared-types.d.ts +8 -1
- package/lib/types/shared-types.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/event-system.ts +4 -3
- package/src/kit.ts +76 -5
- package/src/types/shared-types.ts +11 -1
- package/src/types/vylo.d.ts +3790 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Listener | @evitcastudio/kit</title><meta name="description" content="Documentation for @evitcastudio/kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@evitcastudio/kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@evitcastudio/kit</a></li><li><a href="../modules/types_shared-types.html">types/shared-types</a></li><li><a href="types_shared-types.Listener.html">Listener</a></li></ul><h1>Type Alias Listener</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Listener</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">pData</span><span class="tsd-signature-symbol">:</span> <a href="types_shared-types.EmitterEvent.html" class="tsd-signature-type tsd-kind-type-alias">EmitterEvent</a><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="__type"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">pData</span><span class="tsd-signature-symbol">:</span> <a href="types_shared-types.EmitterEvent.html" class="tsd-signature-type tsd-kind-type-alias">EmitterEvent</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">pData</span>: <a href="types_shared-types.EmitterEvent.html" class="tsd-signature-type tsd-kind-type-alias">EmitterEvent</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/EvitcaStudio/Kit/blob/
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Listener | @evitcastudio/kit</title><meta name="description" content="Documentation for @evitcastudio/kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@evitcastudio/kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@evitcastudio/kit</a></li><li><a href="../modules/types_shared-types.html">types/shared-types</a></li><li><a href="types_shared-types.Listener.html">Listener</a></li></ul><h1>Type Alias Listener</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Listener</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">pData</span><span class="tsd-signature-symbol">:</span> <a href="types_shared-types.EmitterEvent.html" class="tsd-signature-type tsd-kind-type-alias">EmitterEvent</a><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="__type"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">pData</span><span class="tsd-signature-symbol">:</span> <a href="types_shared-types.EmitterEvent.html" class="tsd-signature-type tsd-kind-type-alias">EmitterEvent</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">pData</span>: <a href="types_shared-types.EmitterEvent.html" class="tsd-signature-type tsd-kind-type-alias">EmitterEvent</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/EvitcaStudio/Kit/blob/ef4592d7854542c8f4d4cb1c51485cda4c869bf9/src/types/shared-types.ts#L22">types/shared-types.ts:22</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@evitcastudio/kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ResourceData | @evitcastudio/kit</title><meta name="description" content="Documentation for @evitcastudio/kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@evitcastudio/kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@evitcastudio/kit</a></li><li><a href="../modules/types_shared-types.html">types/shared-types</a></li><li><a href="types_shared-types.ResourceData.html">ResourceData</a></li></ul><h1>Type Alias ResourceData</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">ResourceData</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">fileName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">resourceIdentifier</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">fileName</span><a id="__typefilename" class="tsd-anchor"></a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">resourceIdentifier</span><a id="__typeresourceidentifier" class="tsd-anchor"></a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li></ul></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/EvitcaStudio/Kit/blob/ef4592d7854542c8f4d4cb1c51485cda4c869bf9/src/types/shared-types.ts#L17">types/shared-types.ts:17</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@evitcastudio/kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>VYLO | @evitcastudio/kit</title><meta name="description" content="Documentation for @evitcastudio/kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@evitcastudio/kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@evitcastudio/kit</a></li><li><a href="../modules/types_shared-types.html">types/shared-types</a></li><li><a href="types_shared-types.VYLO.html">VYLO</a></li></ul><h1>Variable VYLO</h1></div><div class="tsd-signature"><span class="tsd-kind-variable">VYLO</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">VyloType</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/EvitcaStudio/Kit/blob/ef4592d7854542c8f4d4cb1c51485cda4c869bf9/src/types/shared-types.ts#L26">types/shared-types.ts:26</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@evitcastudio/kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
package/lib/bundle/cli/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
|
-
* @evitcastudio/kit@1.
|
|
5
|
-
* Compiled
|
|
4
|
+
* @evitcastudio/kit@1.1.1 git+https://github.com/EvitcaStudio/Kit.git
|
|
5
|
+
* Compiled Tue, 31 Dec 2024 20:00:32 UTC
|
|
6
6
|
* Copyright (c) 2024 Jared Bates, Evitca Studio, "doubleactii"
|
|
7
7
|
*
|
|
8
8
|
* @evitcastudio/kit is licensed under the MIT License.
|
|
@@ -2491,6 +2491,7 @@ function isValidExtension(pExtension) {
|
|
|
2491
2491
|
}
|
|
2492
2492
|
async function processAllFiles() {
|
|
2493
2493
|
try {
|
|
2494
|
+
await clearResourceTypeDirectories(`${resourceOutDirectory}/resources`, RESOURCE_TYPES);
|
|
2494
2495
|
const copyOperations = resourcesToProcess.map(({ filePath, type }) => {
|
|
2495
2496
|
const fileName = basename(filePath);
|
|
2496
2497
|
const resource = resourceJSON[type].find((res) => res.fileName === fileName);
|
|
@@ -2507,6 +2508,19 @@ async function processAllFiles() {
|
|
|
2507
2508
|
logError(`[Error] Processing files in batch: ${pError.message}`);
|
|
2508
2509
|
}
|
|
2509
2510
|
}
|
|
2511
|
+
async function clearResourceTypeDirectories(pBaseDirectory, pDirectoriesToRemove) {
|
|
2512
|
+
try {
|
|
2513
|
+
for (const directory of pDirectoriesToRemove) {
|
|
2514
|
+
const directoryPath = join(pBaseDirectory, directory);
|
|
2515
|
+
const directoryExists = await fs.stat(directoryPath).then((stat) => stat.isDirectory()).catch(() => false);
|
|
2516
|
+
if (directoryExists) {
|
|
2517
|
+
await fs.rm(directoryPath, { recursive: true });
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
} catch (pError) {
|
|
2521
|
+
log(`${error(`[Error]`)} clearing directories: ${pError}`);
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2510
2524
|
async function copyFile(pSource, pDestinationDir, pNewName) {
|
|
2511
2525
|
try {
|
|
2512
2526
|
await fs.mkdir(pDestinationDir, { recursive: true });
|
|
@@ -2561,7 +2575,7 @@ class KitCLI {
|
|
|
2561
2575
|
// package.json
|
|
2562
2576
|
var package_default = {
|
|
2563
2577
|
name: "@evitcastudio/kit",
|
|
2564
|
-
version: "1.
|
|
2578
|
+
version: "1.1.1",
|
|
2565
2579
|
author: "doubleactii 56242467+doubleactii@users.noreply.github.com (https://evitcastudio.com)",
|
|
2566
2580
|
main: "./lib/index.js",
|
|
2567
2581
|
types: "./lib/index.d.ts",
|
|
@@ -2597,6 +2611,7 @@ var package_default = {
|
|
|
2597
2611
|
kit: "./lib/bundle/cli/cli.js"
|
|
2598
2612
|
},
|
|
2599
2613
|
devDependencies: {
|
|
2614
|
+
"@evitcastudio/kit-plugin": "^1.0.5",
|
|
2600
2615
|
"@types/bun": "latest",
|
|
2601
2616
|
"@types/node": "^22.10.2",
|
|
2602
2617
|
bun: "^1.1.42",
|
package/lib/event-system.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import './types/shared-types';
|
|
2
|
+
import type { KitPlugin } from '@evitcastudio/kit-plugin';
|
|
2
3
|
export declare class EventEmitter {
|
|
3
4
|
private listener;
|
|
4
5
|
private plugin;
|
|
5
|
-
constructor(pListener: Listener, pPlugin:
|
|
6
|
+
constructor(pListener: Listener, pPlugin: KitPlugin);
|
|
6
7
|
/**
|
|
7
8
|
* Emit an event to all listeners.
|
|
8
9
|
* @param pEvent - The event to emit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-system.d.ts","sourceRoot":"","sources":["../src/event-system.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"event-system.d.ts","sourceRoot":"","sources":["../src/event-system.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,MAAM,CAAY;gBAEd,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS;IAKnD;;;OAGG;IACH,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;CAcnC"}
|
package/lib/event-system.js
CHANGED
package/lib/kit.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KitPlugin } from '@evitcastudio/kit-plugin';
|
|
2
|
+
import './types/shared-types';
|
|
2
3
|
export declare class Kit {
|
|
3
4
|
/**
|
|
4
5
|
* A record of all plugins registered with the Kit class.
|
|
@@ -12,21 +13,22 @@ export declare class Kit {
|
|
|
12
13
|
* A record of all event listeners.
|
|
13
14
|
*/
|
|
14
15
|
private static events;
|
|
16
|
+
private constructor();
|
|
15
17
|
/**
|
|
16
18
|
* Initialize the Kit class with plugins.
|
|
17
19
|
* @param pPlugins - An array of plugins to initialize.
|
|
18
20
|
*/
|
|
19
|
-
static init(pPlugins:
|
|
21
|
+
static init<T extends KitPlugin>(pPlugins: KitPluginConstructor<T>[]): void;
|
|
20
22
|
/**
|
|
21
23
|
* Register a plugin with the Kit class.
|
|
22
24
|
* @param pPlugin - The plugin to register.
|
|
23
25
|
*/
|
|
24
|
-
static registerPlugin(pPlugin:
|
|
26
|
+
static registerPlugin<T extends KitPlugin>(pPlugin: KitPluginConstructor<T>): void;
|
|
25
27
|
/**
|
|
26
28
|
* Gets a plugin by name.
|
|
27
29
|
* @param pName - String name of the plugin to retrieve.
|
|
28
30
|
*/
|
|
29
|
-
static getPlugin<T>(pName: string): T | undefined;
|
|
31
|
+
static getPlugin<T extends KitPlugin>(pName: string): T | undefined;
|
|
30
32
|
/**
|
|
31
33
|
* Lists all registered plugins.
|
|
32
34
|
*/
|
|
@@ -50,5 +52,14 @@ export declare class Kit {
|
|
|
50
52
|
* @param pListener - The listener to remove.
|
|
51
53
|
*/
|
|
52
54
|
static off(pPluginName: string, pEventName: string, pListener: (pData: EmitterEvent) => void): void;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the resource locator for the engine to reference the files we have in the resources folder. interface | map | icon | macro | sound are checked for.
|
|
57
|
+
* @param pData - An array of each file that was found in the resources folder
|
|
58
|
+
*/
|
|
59
|
+
private static setResource;
|
|
60
|
+
/**
|
|
61
|
+
* Sets the resources found in resources and preloads all interfaces found.
|
|
62
|
+
*/
|
|
63
|
+
static setResources(): Promise<void>;
|
|
53
64
|
}
|
|
54
65
|
//# sourceMappingURL=kit.d.ts.map
|
package/lib/kit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,sBAAsB,CAAC;AAiB9B,qBAAa,GAAG;IACZ;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,OAAO,CAAiC;IACvD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAmC;IAC1D;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,MAAM,CAAmD;IAExE,OAAO;IAIP;;;OAGG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,SAAS,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI;IAM3E;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,SAAS,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI;IAkBlF;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAInE;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,MAAM,EAAE;IAI7B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,IAAI;IAWlB;;;;;MAKE;IACH,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,GAAG,IAAI;IAQ7E;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;IAOnG;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAiB1B;;OAEG;WACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CA0B7C"}
|
package/lib/kit.js
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { EventEmitter } from './event-system';
|
|
2
|
+
import './types/shared-types';
|
|
3
|
+
const VYLO = globalThis.VYLO;
|
|
4
|
+
const extensionToPath = {
|
|
5
|
+
'.vyint': 'interface',
|
|
6
|
+
'.vym': 'map',
|
|
7
|
+
'.vyi': 'icon',
|
|
8
|
+
'.vymac': 'macros',
|
|
9
|
+
'.aac': 'sound',
|
|
10
|
+
'.mp3': 'sound',
|
|
11
|
+
'.wav': 'sound',
|
|
12
|
+
'.m4a': 'sound',
|
|
13
|
+
'.ogg': 'sound',
|
|
14
|
+
'.flac': 'sound'
|
|
15
|
+
};
|
|
2
16
|
export class Kit {
|
|
3
17
|
/**
|
|
4
18
|
* A record of all plugins registered with the Kit class.
|
|
@@ -12,6 +26,9 @@ export class Kit {
|
|
|
12
26
|
* A record of all event listeners.
|
|
13
27
|
*/
|
|
14
28
|
static events = {};
|
|
29
|
+
constructor() {
|
|
30
|
+
throw new Error('[Kit] is not to be instantiated.');
|
|
31
|
+
}
|
|
15
32
|
/**
|
|
16
33
|
* Initialize the Kit class with plugins.
|
|
17
34
|
* @param pPlugins - An array of plugins to initialize.
|
|
@@ -88,4 +105,49 @@ export class Kit {
|
|
|
88
105
|
Kit.events[eventScope].splice(Kit.events[eventScope].indexOf(pListener), 1);
|
|
89
106
|
}
|
|
90
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Sets the resource locator for the engine to reference the files we have in the resources folder. interface | map | icon | macro | sound are checked for.
|
|
110
|
+
* @param pData - An array of each file that was found in the resources folder
|
|
111
|
+
*/
|
|
112
|
+
static setResource(pData) {
|
|
113
|
+
pData.forEach((pResource) => {
|
|
114
|
+
const extensionMatch = pResource.fileName.match(/\.[^.]+$/);
|
|
115
|
+
const fileNameWithoutExtensionMatch = pResource.fileName.match(/(.+?)(?=\.[^.]+$|$)/);
|
|
116
|
+
if (extensionMatch && fileNameWithoutExtensionMatch) {
|
|
117
|
+
const extension = extensionMatch[0];
|
|
118
|
+
const fileNameWithoutExtension = fileNameWithoutExtensionMatch[0];
|
|
119
|
+
const resourceType = extensionToPath[extension];
|
|
120
|
+
if (resourceType) {
|
|
121
|
+
globalThis.VYLO.Resource.setResource(resourceType, fileNameWithoutExtension, `resources/${resourceType}/${pResource.resourceIdentifier}`, true);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Sets the resources found in resources and preloads all interfaces found.
|
|
128
|
+
*/
|
|
129
|
+
static async setResources() {
|
|
130
|
+
if (!globalThis.VYLO) {
|
|
131
|
+
throw new Error('[Kit] VYLO is not defined. Please ensure the VYLO variable is available in the global namespace.');
|
|
132
|
+
}
|
|
133
|
+
const resourcePath = './resource.json';
|
|
134
|
+
// Load the resource json and set the resources found
|
|
135
|
+
try {
|
|
136
|
+
const response = await fetch(resourcePath);
|
|
137
|
+
if (!response.ok) {
|
|
138
|
+
throw new Error(`[Kit] HTTP error! Status: ${response.status}`);
|
|
139
|
+
}
|
|
140
|
+
const resourceJSON = await response.json();
|
|
141
|
+
if (resourceJSON) {
|
|
142
|
+
const resources = Object.values(resourceJSON);
|
|
143
|
+
// Group all data from separate arrays in object to one unified array of all resource data
|
|
144
|
+
const consolidatedData = resources.flat();
|
|
145
|
+
// Set all the resources
|
|
146
|
+
this.setResource(consolidatedData);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (pError) {
|
|
150
|
+
console.error(`[Kit] error reading ${resourcePath}`, pError);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
91
153
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { KitPlugin } from '@evitcastudio/kit-plugin';
|
|
1
2
|
declare global {
|
|
2
3
|
/**
|
|
3
4
|
* The EmitterEvent type is used to define the shape of the data that is passed to the event listeners.
|
|
@@ -12,7 +13,13 @@ declare global {
|
|
|
12
13
|
*/
|
|
13
14
|
data?: Record<string, any>;
|
|
14
15
|
} & Record<string, any>;
|
|
16
|
+
type ResourceData = {
|
|
17
|
+
resourceIdentifier: string;
|
|
18
|
+
fileName: string;
|
|
19
|
+
};
|
|
15
20
|
type Listener = (pData: EmitterEvent) => void;
|
|
21
|
+
type KitPluginConstructor<T extends KitPlugin> = new () => T;
|
|
22
|
+
var VYLO: VyloType;
|
|
16
23
|
}
|
|
17
|
-
export type {
|
|
24
|
+
export type {};
|
|
18
25
|
//# sourceMappingURL=shared-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-types.d.ts","sourceRoot":"","sources":["../../src/types/shared-types.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,YAAY,GAAG;QAChB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAExB,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"shared-types.d.ts","sourceRoot":"","sources":["../../src/types/shared-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,CAAC,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,YAAY,GAAG;QAChB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAExB,KAAK,YAAY,GAAG;QAChB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,QAAQ,EAAE,MAAM,CAAA;KACnB,CAAC;IAEF,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAE9C,KAAK,oBAAoB,CAAC,CAAC,SAAS,SAAS,IAAI,UAAU,CAAC,CAAC;IAE7D,IAAI,IAAI,EAAE,QAAQ,CAAC;CACtB;AAED,YAAY,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evitcastudio/kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"author": "doubleactii 56242467+doubleactii@users.noreply.github.com (https://evitcastudio.com)",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"kit": "./lib/bundle/cli/cli.js"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@evitcastudio/kit-plugin": "^1.0.5",
|
|
39
40
|
"@types/bun": "latest",
|
|
40
41
|
"@types/node": "^22.10.2",
|
|
41
42
|
"bun": "^1.1.42",
|
package/src/event-system.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import './types/shared-types';
|
|
2
|
+
import type { KitPlugin } from '@evitcastudio/kit-plugin';
|
|
2
3
|
export class EventEmitter {
|
|
3
4
|
private listener: Listener;
|
|
4
|
-
private plugin:
|
|
5
|
+
private plugin: KitPlugin;
|
|
5
6
|
|
|
6
|
-
constructor(pListener: Listener, pPlugin:
|
|
7
|
+
constructor(pListener: Listener, pPlugin: KitPlugin) {
|
|
7
8
|
this.listener = pListener;
|
|
8
9
|
this.plugin = pPlugin;
|
|
9
10
|
}
|
package/src/kit.ts
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import { EventEmitter } from './event-system';
|
|
2
|
-
import type {
|
|
2
|
+
import type { KitPlugin } from '@evitcastudio/kit-plugin';
|
|
3
|
+
import './types/shared-types';
|
|
4
|
+
|
|
5
|
+
const VYLO: VyloType = globalThis.VYLO;
|
|
6
|
+
|
|
7
|
+
const extensionToPath: Record<string, string> = {
|
|
8
|
+
'.vyint': 'interface',
|
|
9
|
+
'.vym': 'map',
|
|
10
|
+
'.vyi': 'icon',
|
|
11
|
+
'.vymac': 'macros',
|
|
12
|
+
'.aac': 'sound',
|
|
13
|
+
'.mp3': 'sound',
|
|
14
|
+
'.wav': 'sound',
|
|
15
|
+
'.m4a': 'sound',
|
|
16
|
+
'.ogg': 'sound',
|
|
17
|
+
'.flac': 'sound'
|
|
18
|
+
}
|
|
3
19
|
|
|
4
20
|
export class Kit {
|
|
5
21
|
/**
|
|
6
22
|
* A record of all plugins registered with the Kit class.
|
|
7
23
|
*/
|
|
8
|
-
private static plugins: Record<string,
|
|
24
|
+
private static plugins: Record<string, KitPlugin> = {};
|
|
9
25
|
/**
|
|
10
26
|
* A set of all plugin emitters.
|
|
11
27
|
*/
|
|
@@ -15,11 +31,15 @@ export class Kit {
|
|
|
15
31
|
*/
|
|
16
32
|
private static events: Record<string, Array<(pData: any) => void>> = {};
|
|
17
33
|
|
|
34
|
+
private constructor() {
|
|
35
|
+
throw new Error('[Kit] is not to be instantiated.');
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
/**
|
|
19
39
|
* Initialize the Kit class with plugins.
|
|
20
40
|
* @param pPlugins - An array of plugins to initialize.
|
|
21
41
|
*/
|
|
22
|
-
static init(pPlugins:
|
|
42
|
+
static init<T extends KitPlugin>(pPlugins: KitPluginConstructor<T>[]): void {
|
|
23
43
|
pPlugins.forEach(pPlugin => {
|
|
24
44
|
this.registerPlugin(pPlugin);
|
|
25
45
|
});
|
|
@@ -29,7 +49,7 @@ export class Kit {
|
|
|
29
49
|
* Register a plugin with the Kit class.
|
|
30
50
|
* @param pPlugin - The plugin to register.
|
|
31
51
|
*/
|
|
32
|
-
static registerPlugin(pPlugin:
|
|
52
|
+
static registerPlugin<T extends KitPlugin>(pPlugin: KitPluginConstructor<T>): void {
|
|
33
53
|
const plugin = new pPlugin();
|
|
34
54
|
|
|
35
55
|
if (Kit.plugins[plugin.name]) {
|
|
@@ -51,7 +71,7 @@ export class Kit {
|
|
|
51
71
|
* Gets a plugin by name.
|
|
52
72
|
* @param pName - String name of the plugin to retrieve.
|
|
53
73
|
*/
|
|
54
|
-
static getPlugin<T
|
|
74
|
+
static getPlugin<T extends KitPlugin>(pName: string): T | undefined {
|
|
55
75
|
return Kit.plugins[pName] as T;
|
|
56
76
|
}
|
|
57
77
|
|
|
@@ -103,4 +123,55 @@ export class Kit {
|
|
|
103
123
|
Kit.events[eventScope].splice(Kit.events[eventScope].indexOf(pListener), 1);
|
|
104
124
|
}
|
|
105
125
|
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Sets the resource locator for the engine to reference the files we have in the resources folder. interface | map | icon | macro | sound are checked for.
|
|
129
|
+
* @param pData - An array of each file that was found in the resources folder
|
|
130
|
+
*/
|
|
131
|
+
private static setResource(pData: ResourceData[]): void {
|
|
132
|
+
pData.forEach((pResource: ResourceData): void => {
|
|
133
|
+
const extensionMatch = pResource.fileName.match(/\.[^.]+$/);
|
|
134
|
+
const fileNameWithoutExtensionMatch = pResource.fileName.match(/(.+?)(?=\.[^.]+$|$)/);
|
|
135
|
+
|
|
136
|
+
if (extensionMatch && fileNameWithoutExtensionMatch) {
|
|
137
|
+
const extension = extensionMatch[0];
|
|
138
|
+
const fileNameWithoutExtension = fileNameWithoutExtensionMatch[0];
|
|
139
|
+
const resourceType = extensionToPath[extension];
|
|
140
|
+
|
|
141
|
+
if (resourceType) {
|
|
142
|
+
globalThis.VYLO.Resource.setResource(resourceType, fileNameWithoutExtension, `resources/${resourceType}/${pResource.resourceIdentifier}`, true);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Sets the resources found in resources and preloads all interfaces found.
|
|
150
|
+
*/
|
|
151
|
+
static async setResources(): Promise<void> {
|
|
152
|
+
if (!globalThis.VYLO) {
|
|
153
|
+
throw new Error('[Kit] VYLO is not defined. Please ensure the VYLO variable is available in the global namespace.');
|
|
154
|
+
}
|
|
155
|
+
const resourcePath = './resource.json';
|
|
156
|
+
// Load the resource json and set the resources found
|
|
157
|
+
try {
|
|
158
|
+
const response = await fetch(resourcePath);
|
|
159
|
+
|
|
160
|
+
if (!response.ok) {
|
|
161
|
+
throw new Error(`[Kit] HTTP error! Status: ${response.status}`);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const resourceJSON = await response.json();
|
|
165
|
+
|
|
166
|
+
if (resourceJSON) {
|
|
167
|
+
const resources: ResourceData[] = Object.values(resourceJSON);
|
|
168
|
+
// Group all data from separate arrays in object to one unified array of all resource data
|
|
169
|
+
const consolidatedData = resources.flat();
|
|
170
|
+
// Set all the resources
|
|
171
|
+
this.setResource(consolidatedData);
|
|
172
|
+
}
|
|
173
|
+
} catch (pError) {
|
|
174
|
+
console.error(`[Kit] error reading ${resourcePath}`, pError);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
106
177
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { KitPlugin } from '@evitcastudio/kit-plugin';
|
|
1
2
|
declare global {
|
|
2
3
|
/**
|
|
3
4
|
* The EmitterEvent type is used to define the shape of the data that is passed to the event listeners.
|
|
@@ -13,7 +14,16 @@ declare global {
|
|
|
13
14
|
data?: Record<string, any>;
|
|
14
15
|
} & Record<string, any>;
|
|
15
16
|
|
|
17
|
+
type ResourceData = {
|
|
18
|
+
resourceIdentifier: string,
|
|
19
|
+
fileName: string
|
|
20
|
+
};
|
|
21
|
+
|
|
16
22
|
type Listener = (pData: EmitterEvent) => void;
|
|
23
|
+
|
|
24
|
+
type KitPluginConstructor<T extends KitPlugin> = new () => T;
|
|
25
|
+
|
|
26
|
+
var VYLO: VyloType;
|
|
17
27
|
}
|
|
18
28
|
|
|
19
|
-
export type {
|
|
29
|
+
export type {};
|