sammi-next 1.0.0

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.
@@ -0,0 +1,78 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "$schema": { "type": "string" },
5
+ "id": {
6
+ "description": "Specify a unique id for your extension here. Please use alphanumeric characters, dashes, and underscores only.",
7
+ "type": "string",
8
+ "minLength": 1,
9
+ "pattern": "^[a-z0-9-_]+$"
10
+ },
11
+ "name": {
12
+ "description": "This section names your extension, and is visible in SAMMI Bridge and SAMMI Core. Please use alphanumeric characters and spaces only.",
13
+ "type": "string",
14
+ "minLength": 1,
15
+ "pattern": "^[a-zA-Z0-9 -_]+$"
16
+ },
17
+ "info": {
18
+ "description": "This section is for descriptive text about the extension, e.g. what the extension does. This information is displayed to the users in SAMMI Bridge-Extensions tab when they hover over the extension name inside the list of installed extensions.",
19
+ "type": "string",
20
+ "default": ""
21
+ },
22
+ "version": {
23
+ "description": "Specify your extension version here, using numbers and dots (e.g., 2.01). This is crucial for the automatic version checker in Bridge, which can notify users of updates.",
24
+ "type": "string",
25
+ "minLength": 1,
26
+ "pattern": "^\\d+(?:\\.\\d+)*(?:-.*)?$"
27
+ },
28
+ "entry": {
29
+ "description": "Specify your script.ts path here. In your [insert_script] section, you’re encouraged to write your own TypeScript code.",
30
+ "type": "string",
31
+ "minLength": 1,
32
+ "default": "src/script.ts"
33
+ },
34
+ "external": {
35
+ "description": "Specify your external.html path here. Your [insert_external] section appears inside the extension’s tab in Bridge, and it provides a visual interface for the extension if needed. It’s written in HTML and CSS.",
36
+ "type": "string",
37
+ "minLength": 1,
38
+ "default": "src/external.html"
39
+ },
40
+ "over": {
41
+ "description": "Specify your over.json path here. In your [insert_over] section you simply copy and paste your deck from SAMMI Core you wish to distribute with your extension. When users install your extension, the deck will be automatically added to their SAMMI Core.",
42
+ "type": "string",
43
+ "minLength": 1,
44
+ "default": "src/over.json"
45
+ },
46
+ "out": {
47
+ "description": "Configuration related with the extension building.",
48
+ "type": "object",
49
+ "properties": {
50
+ "dir": {
51
+ "description": "The path where the extension will build to.",
52
+ "type": "string",
53
+ "minLength": 1,
54
+ "pattern": "^[^<>:\"|?*]+$",
55
+ "default": "dist"
56
+ },
57
+ "js": {
58
+ "description": "The file name of the final JavaScript file.",
59
+ "type": "string",
60
+ "minLength": 4,
61
+ "pattern": "^[\\w\\-. ]+\\.js$",
62
+ "default": "extension.js"
63
+ },
64
+ "sef": {
65
+ "description": "The file name of the final SAMMI Extension File.",
66
+ "type": "string",
67
+ "minLength": 5,
68
+ "pattern": "^[\\w\\-. ]+\\.sef$",
69
+ "default": "extension.sef"
70
+ }
71
+ },
72
+ "required": [],
73
+ "additionalProperties": false
74
+ }
75
+ },
76
+ "required": ["name", "id", "version", "entry"],
77
+ "additionalProperties": false
78
+ }
@@ -0,0 +1,33 @@
1
+ <!--For Extension info, read How to make extensions.txt in Extension folder-->
2
+ <!--Bridge V7.30-->
3
+
4
+ <!DOCTYPE html>
5
+ <html lang="en">
6
+ <head>
7
+ <title>SAMMI Bridge Preview</title>
8
+ <meta charset="utf-8">
9
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
10
+ <link rel="shortcut icon" type="image/x-icon" href="https://raw.githubusercontent.com/SAMMISolutions/SAMMI-Bridge/main/favicon.ico">
11
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/SAMMISolutions/SAMMI-Bridge@main/lib/bootstrap.min.css">
12
+ <style>body{font-family:Lato,sans-serif;background-color:#040b15}h1{font-size:calc(1.2em + 1vw)}a{color:#ffac7c;text-decoration:underline}a:hover{color:#ff6810;text-decoration:underline}.tslCollapse,.tslCollapse a,.tslCollapse:hover{text-decoration:none;color:#fff}.tslCollapse.collapsed:before{content:'Show Options \01F847';width:15px}.tslCollapse:before{content:'Hide Options \01F845';width:15px}.SAMMITestTriggers .form-check-input[type=checkbox]{vertical-align:text-bottom}#footer .tslCollapse.collapsed:before{content:'Show Tabs \01F847';width:15px}#footer .tslCollapse:before{content:'Hide Tabs \01F845';width:15px}#SAMMIcorelog{background:#040b15;padding:5px 15px;display:block;position:relative;float:left;text-align:left;max-height:50%;overflow-y:auto}#debugLog,#debugLogContent{border:none;background-color:rgba(0,0,0,0);box-shadow:none}#debugLog .nav-link{padding:.2rem 1rem}#SAMMIBridge{overflow:hidden;padding:5px;margin:2px;padding:1px}samp{width:200px;word-break:break-all;white-space:normal}input{padding:0;margin:1px 1px}button{padding:2px 5px;margin:3px 0;box-shadow:2 2px #c5c5c5}button:active{background-color:#797979;color:#fff;box-shadow:0 0 #dfdfdf;transform:translateY(1px)}.nav{padding-left:0;margin-bottom:0}.nav-pills .nav-link{font-family:Arial;padding:.4em .6em .1em .6em;margin:2px 1px 0 1px!important;background:#afb1b8;background-color:linear-gradient(0deg,#afb1b8 15%,#cbcbd5 61%);font-weight:700;color:#1f2036;border-radius:5px 5px 0 0;text-shadow:0 1px 2px #c3c3c3;transition:10ms}.nav-pills>li>.nav-link.active{background-image:linear-gradient(to bottom,#761a2c ,#761a2c);border:1px solid #761a2c;color:#fff;border:1px solid #761a2c;text-shadow:1px 1px 3px rgb(0 0 0 / 100%)}.nav-item{z-index:998}.tab-content{background-color:rgba(22,53,100,.769);box-shadow:.5rem .5rem .5rem #00000080;min-height:50px;width:100%;border-radius:3px;overflow:hidden;padding:20px}.draggable-source--is-dragging{opacity:0}@media (max-width:576px){.nav-pills .nav-link{border-radius:5px 5px 0 0;font-weight:700;padding:.2em .4em .1em .4em;font-size:.92em}button{font-size:.93em;padding:2px 5px;margin:3px 0;box-shadow:2 2px #c5c5c5}button:active{background-color:#797979;color:#fff;box-shadow:0 0 #dfdfdf;transform:translateY(1px)}}.btn-primary{background-color:#535861b5;border-color:rgb(72 78 89)}.btn-primary:hover{background-color:#60646ad9;border-color:#60646ad9}.notabs>.tab-pane{display:block!important;opacity:1!important}.notabs button,.notabs input{color:#fff;background-color:#4c4c4c;border-color:#464546}#close-tab-button{display:none;position:absolute;top:0;left:50%;transform:translateX(-50%);font-size:40px;color:rgba(255,255,255,.9);background-color:rgba(5,11,20,.9);padding:10px;border-radius:50%;width:60px;height:60px;line-height:40px;text-align:center;z-index:9998;pointer-events:auto}#close-tab-button.hovered{color:rgba(255,0,0,.9)}.connected{color:#4ad84a}.disconnected{color:#fb4848}.connecting{color:#fbbd48}.opacity-90{opacity:.9}@keyframes shake{0%{transform:translate(0,0) rotate(0)}20%{transform:translate(0,0) rotate(-3deg)}40%{transform:translate(0,0) rotate(3deg)}60%{transform:translate(0,0) rotate(-3deg)}80%{transform:translate(0,0) rotate(3deg)}100%{transform:translate(0,0) rotate(0)}}.shaking{animation:shake .82s cubic-bezier(.36,.07,.19,.97) infinite both;transform-origin:center center}#ExtensionsSortAuthor,#ExtensionsSortDownload,#ExtensionsSortName{cursor:pointer}</style>
13
+ </head>
14
+
15
+ <body><div class="container"><h1 class="text-center mt-1">SAMMI Bridge Preview</h1><div class="row justify-content-center"><div class="col col-auto"><svg id="toclient_circle" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="red" class="bi bi-circle-fill d-md-none me-1" viewBox="0 0 16 16"><circle cx="8" cy="8" r="8"></circle></svg> <span>SAMMI Core</span><span class="d-none d-md-inline-flex me-1">: </span><span id="toclient" class="disconnected d-none d-md-inline-flex">Not connected.</span></div><div class="col col-auto"><i id="extensions_icon" class="fas fa-times-circle d-md-none me-1"></i> <span>Extensions</span><span class="d-none d-md-inline-flex me-1">: </span><span id="extensions_status" class="d-none d-md-inline-flex">No extensions installed.</span></div></div><br><div class="modal fade" id="sammiModalElem" tabindex="-1" aria-labelledby="sammiModalElemLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><h5 class="modal-title" id="sammiModalElemTitle">SAMMI</h5><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div><div class="modal-body" id="sammiModalElemContent">..</div><div class="modal-footer"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">OK</button></div></div></div></div><span id="close-tab-button">×</span><div class="row justify-content-center g-0"><ul class="nav nav-pills mb-0" id="extensions-tab" role="tablist"></ul></div><div class="tab-content" id="extensions-tabContent"><div class="tab-pane" id="content-settings" role="tabpanel" title="Settings" data-type="settings"><div class="row pt-3"><h5>Bridge Connection</h5><div class="fs-7 mb-2"><span class="me-2">Version:</span><span name="version"></span></div><div class="fs-7 mb-0"><span class="me-2">Current IP:</span><span name="currentIP"></span></div><div class="fs-7 mb-2"><span class="me-2">Current Port:</span><span name="currentPort"></span></div><div class="col"><div class="row"><label for="inputPassword" class="col-sm-5 col-form-label">IP Address:</label><div class="col-sm-4 w-auto"><input type="text" name="nIPbox" value="127.0.0.1" class="form-control form-control-sm"></div></div><div class="row"><label for="inputPassword" class="col-sm-5 col-form-label">Port:</label><div class="col-sm-4 w-auto"><input type="number" min="0" max="65535" name="nPortBox" value="9425" class="form-control form-control-sm"></div></div><div class="row"><label for="inputPassword" class="col-sm-5 col-form-label">Password (optional):</label><div class="col-sm-4 w-auto"><input type="password" name="nPassBox" size="20" value="" class="form-control form-control-sm"></div></div><div class="mt-1 row"><button type="button" id="cnctbutton" class="btn btn-primary btn-sm mb-2 w-auto ms-3">Connect</button></div></div></div><div class="row pt-3 d-block"><h5>Message Logging</h5><div class="pl-5 ml-5"><div class="form-check form-switch"><input class="form-check-input" type="checkbox" id="dbgBridge" onclick="SAMMIDebugLog(this)"> <label class="form-check-label" for="flexSwitchCheckDefault">SAMMI</label></div><div class="tab-content p-0 mt-2" id="debugLogContent"><div class="tab-pane fade show active" id="SAMMIBridge" role="tabpanel" aria-labelledby="SAMMIBridge-tab"><div id="SAMMIcorelog" class="col col-10 text-wrap">Logging is disabled.</div></div></div></div></div></div><div class="tab-pane non-draggable" id="content-extensions" role="tabpanel" title="Extensions" data-type="default"><div class="row pt-3"><h5>Extensions</h5></div><div class="table-responsive"><table class="table table-sm table-hover table-dark" id="extensionTable" style="color:#afb1b8"><thead style="background-color:#182b50"><tr><th class="pl-5 d-none d-sm-table-cell" id="ExtensionsSortName">Name</th><th class="pl-5" id="ExtensionsSortAuthor">Author</th><th class="pl-5"><span class="d-none d-sm-inline">Current</span> <i class="fas fa-clock d-sm-none"></i></th><th class="pl-5"><span class="d-none d-sm-inline">Latest</span> <i class="fas fa-rocket d-sm-none"></i></th><th class="pl-5" id="ExtensionsSortDownload"><span class="d-none d-sm-inline">Download</span> <i class="fas fa-download d-sm-none"></i></th></tr></thead><tbody id="extensionTableBody"></tbody></table></div></div><div class="tab-pane" id="content-triggers" role="tabpanel" title="Twitch Triggers" data-type="default"><form id="SAMMITestTwitchFollow" class="SAMMITestTriggers"><div class="form-check ps-0 d-flex align-items-center"><button type="submit" class="btn btn-primary btn-sm me-1">Test Follower</button> <label class="form-check-label me-1">Username:</label> <input type="text" class="form-control form-control-sm w-auto me-2" name="name"></div></form><form id="SAMMITestTwitchSubs" class="SAMMITestTriggers"><button type="submit" class="btn btn-primary btn-sm me-1">Test Sub</button> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#hidesubs" role="button" aria-expanded="false" aria-controls="hidesubs"></a><div class="collapse" id="hidesubs"><div class="form-group"><label>Username:</label> <input type="text" class="form-control form-control-sm w-auto" name="name"></div><div class="form-group mb-2"><label class="me-2">Tier:</label><div class="form-check form-check-inline"><input type="radio" class="form-check-input" name="tier" value="Tier 1" checked=""> <label class="form-check-label">Tier 1</label></div><div class="form-check form-check-inline"><input type="radio" class="form-check-input" name="tier" value="Tier 2"> <label class="form-check-label">Tier 2</label></div><div class="form-check form-check-inline"><input type="radio" class="form-check-input" name="tier" value="Tier 3"> <label class="form-check-label">Tier 3</label></div><div class="form-check form-check-inline"><input type="radio" class="form-check-input" name="tier" value="Prime"> <label class="form-check-label">Prime</label></div></div><div class="form-group mb-2"><label class="me-2">Gift Options:</label><div class="form-check form-check-inline"><input type="checkbox" class="form-check-input" name="subgift" value="subgift"> <label class="form-check-label">SubGift</label></div><div class="form-check form-check-inline"><input type="checkbox" class="form-check-input" name="anongift" value="anongift"> <label class="form-check-label">AnonGift</label></div></div><div class="form-group mb-2"><label>Months:</label> <input type="number" class="form-control form-control-sm w-auto" min="1" max="999" name="submonths" value="1"></div><div class="form-group mb-2"><label>Message:</label> <textarea class="form-control form-control-sm w-75" rows="1" name="submessage"></textarea></div></div></form><form id="SAMMITestTwitchSubGift" class="SAMMITestTriggers"><div class="form-group d-flex align-items-center"><button type="submit" class="btn btn-primary btn-sm me-1">Test Subs Gift Amount</button> <label class="me-2">Amount:</label> <input type="number" class="form-control form-control-sm w-auto" min="1" max="999" name="subGiftAmount" value="1"></div></form><form id="SAMMITestTwitchBits" class="SAMMITestTriggers"><button type="submit" class="btn btn-primary btn-sm me-1">Test Bits</button> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#hidebits" role="button" aria-expanded="false" aria-controls="hidebits"></a><div class="collapse" id="hidebits"><div class="form-check ps-0 d-flex align-items-center mb-2"><label class="form-check-label me-1">Username:</label> <input type="text" name="name" class="form-control form-control-sm w-auto me-2" value=""></div><div class="form-check ps-0 d-flex align-items-center mb-2"><label class="form-check-label me-1">Amount of bits:</label> <input type="number" min="1" max="99999" name="bitsamount" class="form-control form-control-sm w-auto me-2" value="10"></div><div class="form-check ps-0 d-flex align-items-center mb-2"><label class="form-check-label me-1">Message:</label> <textarea name="bitsmessage" class="form-control form-control-sm w-75" rows="1" style="margin:5px 0">Hello World!</textarea></div></div></form><form id="SAMMITestTwitchPoints" class="SAMMITestTriggers"><div><button type="submit" class="btn btn-primary btn-sm me-1">Test Channel Points</button> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#hidepoints" role="button" aria-expanded="false" aria-controls="hidebits"></a></div><div class="collapse" id="hidepoints"><div class="form-group mb-2"><label>Username:</label> <input type="text" class="form-control form-control-sm w-auto" name="name"></div><div class="form-group mb-2"><label>Redeem Name:</label> <input type="text" class="form-control form-control-sm w-auto mb-1" name="channelPointsName"></div><div class="form-group mb-2"><label>Redeem Cost:</label> <input type="number" class="form-control form-control-sm w-auto" min="1" max="9999" name="channelPointsCost" value="50"></div><div class="form-group mb-2"><label>Redeem Message:</label> <textarea class="form-control form-control-sm w-75" rows="1" name="channelPointsMsg"></textarea><div class="form-check mt-1"><input type="checkbox" class="form-check-input" name="channelPointsInput"> <label class="form-check-label">User Input Required</label></div></div></div></form><form id="SAMMITestTwitchRaid" class="SAMMITestTriggers"><button type="submit" class="btn btn-primary btn-sm me-1">Test Raid</button> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#hideraid" role="button" aria-expanded="false" aria-controls="hideraid"></a><div class="collapse" id="hideraid"><div class="form-group mb-2"><label>Username:</label> <input type="text" class="form-control form-control-sm w-auto" name="name"></div><div class="form-group mb-2"><label>Amount:</label> <input type="number" class="form-control form-control-sm w-auto" min="1" max="999" name="raidAmount" value="5"></div></div></form><form id="SAMMITestTwitchPoll" class="SAMMITestTriggers form-inline"><div class="form-group d-flex align-items-center"><button type="submit" class="btn btn-primary btn-sm me-2">Test Poll</button> <select class="form-select-sm w-auto me-2" style="height:30px" aria-label="Poll Type" name="pollType"><option value="begin" selected="">Created</option><option value="progress">Voted</option><option value="end">Ended</option><option value="archive">Archived</option></select> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#hidepoll" role="button" aria-expanded="false" aria-controls="hidepoll"></a></div><div class="collapse mt-2 mb-1" id="hidepoll">Choice amount: <input class="mb-2" type="number" min="2" max="5" name="pollChoiceAmount" value="3"><br>Duration: <input class="mb-2" type="number" min="1" max="3600" name="pollDuration" value="60"><br><input type="checkbox" class="form-check-input" name="pollAllowPoints"> Allow Channel Points</div></form><form id="SAMMITestTwitchPrediction" class="form-inline SAMMITestTriggers"><div class="form-group d-flex align-items-center"><button type="submit" class="btn btn-primary btn-sm me-2">Test Prediction</button> <select class="form-select form-select-sm w-auto me-2" aria-label="Poll Type" name="predictType"><option value="begin" selected="">Created</option><option value="progress">Voted</option><option value="end">Locked</option><option value="archive">Resolved</option></select> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#hideprediction" role="button" aria-expanded="false" aria-controls="hideprediction"></a></div><div class="collapse" id="hideprediction"><div class="form-group mb-2"><label>Outcome amount:</label> <input type="number" class="form-control form-control-sm w-auto" min="2" max="10" name="predictChoiceAmount" value="3"></div><div class="form-group mb-2"><label>Duration:</label> <input type="number" class="form-control form-control-sm w-auto" min="1" max="3600" name="predictionDuration" value="60"></div></div></form><form id="SAMMITestTwitchHypeTrain" class="SAMMITestTriggers"><div class="d-flex align-items-center"><button type="submit" class="btn btn-primary btn-sm me-2">Test Hype Train</button> <select class="form-select form-select-sm w-auto me-2" aria-label="Hype Train Type" name="hypeTrainType"><option value="begin">Begin</option><option value="progress">Progress</option><option value="end">End</option></select> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#hidehypetrain" role="button" aria-expanded="false" aria-controls="hidebits"></a></div><div class="collapse mb-1" id="hidehypetrain"><div class="form-group mb-2"><label>Current level:</label> <input type="number" class="form-control form-control-sm w-auto" min="1" max="50" name="hypeTrainLevel" value="3"></div><div class="form-group mb-2"><label>Current goal:</label> <input type="number" class="form-control form-control-sm w-auto" min="1" max="10000" name="hypeTrainGoal" value="3"></div><div class="form-group mb-2"><label>Goal progress:</label> <input type="number" class="form-control form-control-sm w-auto" min="1" max="10000" name="hypeTrainProgress" value="3"></div></div></form><form id="SAMMITestTwitchShoutout" class="SAMMITestTriggers"><div class="form-group d-flex align-items-center"><button type="submit" class="btn btn-primary btn-sm me-1">Test Shoutout Created</button> <label class="me-2">Username:</label> <input type="text" class="form-control form-control-sm w-auto" name="name"></div></form><form id="SAMMITestTwitchShoutoutReceive" class="SAMMITestTriggers"><div class="form-group d-flex align-items-center"><button type="submit" class="btn btn-primary btn-sm me-1">Test Shoutout Received</button> <label class="me-2">From Username:</label> <input type="text" class="form-control form-control-sm w-auto" name="name"></div></form><form id="SAMMITestTwitchAdbreak" class="SAMMITestTriggers"><button type="submit" class="btn btn-primary btn-sm me-1">Test Ad Break</button> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#hideadbreak" role="button" aria-expanded="false" aria-controls="hideadbreak"></a><div class="collapse" id="hideadbreak"><div class="form-group mb-2"><label>Requester Username:</label> <input type="text" class="form-control form-control-sm w-auto" name="name"></div><div class="form-group mb-2"><input type="checkbox" class="form-check-input" name="adbreakAuto"> Is Automatic</div></div></form><form id="SAMMITestTwitchChat" class="SAMMITestTriggers"><div><button type="submit" class="btn btn-primary btn-sm me-1">Test Chat Message</button> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#hidechatmsg" role="button" aria-expanded="false" aria-controls="hidechatmsg"></a></div><div class="collapse" id="hidechatmsg"><div class="form-check ps-0 d-flex align-items-center mb-2"><label class="form-check-label me-1">Username:</label> <input type="text" class="form-control form-control-sm w-auto me-2" name="name"></div><div class="form-check ps-0 d-flex align-items-center mb-2"><label class="form-check-label me-1">Message:</label> <textarea class="form-control form-control-sm w-75" name="chatMsg">Hello World</textarea></div><input type="checkbox" class="form-check-input" name="chatWhisper"> Whisper <input type="checkbox" class="form-check-input" name="chatFirstTime"> 1st Message<br><input type="checkbox" class="form-check-input" name="chatBroadcaster"> Broadcaster <input type="checkbox" class="form-check-input" name="chatMod"> Mod <input type="checkbox" class="form-check-input" name="chatSub"> Subscriber <input type="checkbox" class="form-check-input" name="chatVip"> VIP <input type="checkbox" class="form-check-input" name="chatFounder"> Founder<br>Subscriber Tier: <select name="chatMsgSubTier"><option value="1">1</option><option value="2">2</option><option value="3">3</option></select> Month: <input type="number" min="0" max="12" maxlength="2" oninput="parseInt(this.value)>parseInt(this.max)&&(this.value=this.max)" name="chatMsgSubMonth" value="1"></div></form><form id="SAMMITestTwitchStream" class="SAMMITestTriggers"><div class="form-group d-flex align-items-center"><button type="submit" class="btn btn-primary btn-sm me-1">Test Stream</button> <select class="form-select form-select-sm w-auto me-2" aria-label="Type" name="streamType"><option value="started" selected="">Started</option><option value="ended">Ended</option></select></div></form><form id="SAMMITestTwitchCharity" class="SAMMITestTriggers"><div class="form-group d-flex align-items-center"><button type="submit" class="btn btn-primary btn-sm me-1">Test Charity</button> <select class="form-select form-select-sm w-auto me-2" aria-label="Type" name="charityType"><option value="start" selected="">Started</option><option value="progress">Progressed</option><option value="stop">Stopped</option><option value="donate">Donated</option></select></div></form></div><div class="tab-pane" id="content-yttriggers" role="tabpanel" title="YouTube Triggers" data-type="default"><div><h5>YouTube Live Test Triggers</h5></div><div class="align-middle align-items-center"><div><button style="margin-right:10px" type="button" class="btn btn-primary btn-sm" id="ytLiveTestSub">Test Subscriber</button></div><div><button style="margin-right:10px" type="button" class="btn btn-primary btn-sm" id="ytLiveTestMember">Test Member</button></div><div><div class="btn-group align-items-center"><button style="margin-right:10px" type="button" class="btn btn-primary btn-sm" id="ytLiveTestMilestone">Test Member Renewal</button> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#YTLiveHideMilestone" role="button" aria-expanded="false" aria-controls="HideMilestone"></a></div><br><div class="collapse" id="YTLiveHideMilestone"><div class="form-check ps-0 d-flex align-items-center"><label class="form-check-label me-1">Level name:</label> <input type="text" class="form-control form-control-sm w-auto me-2" id="YTLiveMilestoneLevel"> <label class="form-check-label me-1">Months:</label> <input type="number" class="form-control form-control-sm w-auto" min="1" max="99" id="YTLiveMilestoneMonth"></div><div class="form-check ps-0 d-flex align-items-center"><label class="form-check-label me-1">Message:</label> <textarea type="text" rows="1" class="form-control form-control-sm w-75" id="YTLiveMilestoneMsg"></textarea></div></div></div><div><div class="btn-group align-items-center"><button style="margin-right:10px" type="button" class="btn btn-primary btn-sm" id="ytLiveTestSuperChat">Test Super Chat</button> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#YTLiveHideSuperChat" role="button" aria-expanded="false" aria-controls="HideSuperChat"></a></div><br><div class="collapse" id="YTLiveHideSuperChat"><div class="form-check ps-0 d-flex align-items-center"><label class="form-check-label me-1">Amount:</label> <input type="number" min="1" max="500000000" class="form-control form-control-sm w-auto me-2" id="YTLiveSuperChatAmount"> <label class="form-check-label me-1">Tier:</label> <input type="number" class="form-control form-control-sm w-auto" min="1" max="9" id="YTLiveSuperChatTier"></div><div class="form-check ps-0 d-flex align-items-center"><label class="form-check-label me-1">Message:</label> <textarea type="text" rows="1" class="form-control form-control-sm w-75" id="YTLiveSuperChatMsg"></textarea></div></div></div><div><div class="btn-group align-items-center"><button style="margin-right:10px" type="button" class="btn btn-primary btn-sm" id="ytLiveTestSuperSticker">Test Super Sticker</button> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#YTLiveHideSuperSticker" role="button" aria-expanded="false" aria-controls="HideSuperSticker"></a></div><br><div class="collapse" id="YTLiveHideSuperSticker"><div class="form-check ps-0 d-flex align-items-center"><label class="form-check-label me-1">Amount:</label> <input type="number" min="1" max="100000" class="form-control form-control-sm w-auto me-2" id="YTLiveSuperStickerAmount"></div></div></div><div><div class="btn-group align-items-center"><button style="margin-right:10px" type="button" class="btn btn-primary btn-sm" id="ytLiveTestChatMessage">Test Chat Message</button> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#YTLiveHideChatMessage" role="button" aria-expanded="false" aria-controls="HideChatMessage"></a></div><br><div class="collapse" id="YTLiveHideChatMessage"><div class="form-check ps-0 d-flex align-items-center"><label class="form-check-label me-1">Display Name:</label> <input type="text" class="form-control form-control-sm w-auto me-2" id="YTLiveChatMessageName"></div><div class="form-check ps-0 d-flex align-items-center"><label class="form-check-label me-1">Message:</label> <textarea type="text" rows="1" class="form-control form-control-sm w-75" id="YTLiveChatMessageMsg"></textarea></div><input type="checkbox" id="YTLiveChatMessageBroadcaster"> Broadcaster <input type="checkbox" id="YTLiveChatMessageMod"> Mod <input type="checkbox" id="YTLiveChatMessageMember"> Member <input type="checkbox" id="YTLiveChatMessageVerified"> Verified</div></div></div></div>
16
+
17
+ <!--Your external script will be inserted here-->
18
+ <!--<script src="example.js"></script>-->
19
+ {{EXTERNAL}}
20
+ </div>
21
+ <div class="row justify-content-center mt-3 px-2 mb-5" id="footer"> <a class="tslCollapse collapsed" data-bs-toggle="collapse" href="#installedextensions" role="button" aria-expanded="false" aria-controls="installedextensions"></a>
22
+ <span class="collapse" id="installedextensions"></span>
23
+ <span id="extensions-tab-buttons" class="mt-2">
24
+ <button id="extensionsshow" class="btn btn-primary btn-sm me-1">Show All Tabs</button> <button id="extensionshide" class="btn btn-primary btn-sm me-1">Hide All Tabs</button> <button id="extensionsresetorder" class="btn btn-primary btn-sm me-1">Reset Tab Order</button> <button onclick="location.reload()" class="btn btn-primary btn-sm me-1">Refresh</button></span>
25
+ </div>
26
+ </div>
27
+
28
+ <script>
29
+ // Your main script will be inserted here
30
+ {{SCRIPT}}
31
+ </script>
32
+ </body></html>
33
+ <!DOCTYPE html>
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # SAMMI Next
2
+
3
+ > Modern builder and runtime for SAMMI Extensions
4
+
5
+ Features:
6
+ - Extension Preview
7
+ - Helper functions
8
+ - Rich Features
9
+ - Optimize Build
10
+ - Fully Typed APIs
11
+
12
+ SAMMI Next is a SAMMI Bridge extensions build tool inspired on Vite that significantly improves the extension development experience. It consists of two major parts:
13
+ - A runtime API with helper functions to develop a SAMMI extension with the SAMMI Next format.
14
+ - A cli that bundles your code with [tsdown], pre-configured to output highly optimized static assets for production.
15
+
16
+ [tsdown]: https://tsdown.dev/
@@ -0,0 +1,148 @@
1
+ import { a as RED_X, i as GREEN_CHECK, o as SAMMI_NEXT_PACKAGE_DIR, r as GLOBAL_NAME, s as version, t as BUILD_PREFIX } from "./constants-CCy1tyHo.mjs";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import colors from "picocolors";
5
+ import chokidar from "chokidar";
6
+ import { build } from "tsdown";
7
+
8
+ //#region src/node/utils.ts
9
+ function displayTime(time) {
10
+ if (time < 1e3) return `${time}ms`;
11
+ time = time / 1e3;
12
+ if (time < 60) return `${time.toFixed(2)}s`;
13
+ const mins = Math.floor(time / 60);
14
+ const seconds = Math.round(time % 60);
15
+ if (seconds === 60) return `${mins + 1}m`;
16
+ return `${mins}m${seconds < 1 ? "" : ` ${seconds}s`}`;
17
+ }
18
+
19
+ //#endregion
20
+ //#region src/node/build.ts
21
+ let BuildMode = /* @__PURE__ */ function(BuildMode) {
22
+ BuildMode[BuildMode["DEV"] = 0] = "DEV";
23
+ BuildMode[BuildMode["PRODUCTION"] = 1] = "PRODUCTION";
24
+ return BuildMode;
25
+ }({});
26
+ const BuildModes = Object.keys(BuildMode);
27
+ function readOptionalFile(path$1) {
28
+ if (!fs.existsSync(path$1)) return;
29
+ return fs.readFileSync(path$1, "utf-8");
30
+ }
31
+ const CommandRE = /\w+\(\w+,\s*{\s*default:/gm;
32
+ function generateSEF(options) {
33
+ const { config, rootDir, mode } = options;
34
+ const content = [];
35
+ const required_files = [
36
+ {
37
+ header: "extension_name",
38
+ content: config.name
39
+ },
40
+ {
41
+ header: "extension_info",
42
+ content: config.info
43
+ },
44
+ {
45
+ header: "extension_version",
46
+ content: config.version
47
+ }
48
+ ];
49
+ for (const field of required_files) content.push(`[${field.header}]`, field.content, "");
50
+ const external = readOptionalFile(path.join(rootDir, config.external));
51
+ content.push("[insert_external]", external ? `<div id="${config.id}-external">${external}</div>` : "", "");
52
+ const script = fs.readFileSync(path.join(rootDir, config.entry), "utf-8");
53
+ content.push("[insert_command]", CommandRE.test(script) ? `${GLOBAL_NAME}.${config.id}.default()` : "", "");
54
+ content.push("[insert_hook]", "", "");
55
+ content.push("[insert_script]", script, "");
56
+ let over = readOptionalFile(path.join(rootDir, config.over));
57
+ if (over && mode === BuildMode.PRODUCTION) over = JSON.stringify(JSON.parse(over));
58
+ content.push("[insert_over]", over && over != "{}" ? over : "", "");
59
+ return content.join("\n");
60
+ }
61
+ function generatePreview(options) {
62
+ const { config, rootDir } = options;
63
+ const external = readOptionalFile(path.join(rootDir, config.external));
64
+ const script = fs.readFileSync(path.join(rootDir, config.entry), "utf-8");
65
+ return fs.readFileSync(path.join(SAMMI_NEXT_PACKAGE_DIR, ".sammi", "preview.blueprint.html"), "utf-8").replace(/{{EXTERNAL}}/g, external ? `<div id="${config.id}-external">${external}</div>` : "").replace(/{{SCRIPT}}/g, script);
66
+ }
67
+ async function buildOnce(options) {
68
+ const { config, rootDir, mode } = options;
69
+ const startTime = Date.now();
70
+ const bundle = await build({
71
+ entry: [config.entry],
72
+ outDir: path.join(rootDir, config.out.dir),
73
+ platform: "browser",
74
+ format: "iife",
75
+ target: ["es2022"],
76
+ sourcemap: false,
77
+ minify: mode === BuildMode.PRODUCTION,
78
+ banner: { js: `/* ${config.name} v${config.version} - Built with SAMMI Next v${version} */` },
79
+ noExternal: ["**"],
80
+ outputOptions: {
81
+ entryFileNames: config.out.js,
82
+ extend: true,
83
+ name: `${GLOBAL_NAME}.${config.id}`,
84
+ exports: "named"
85
+ }
86
+ });
87
+ const tsdownTime = Date.now();
88
+ console.info(GREEN_CHECK, BUILD_PREFIX, `built ${config.out.js} in ${displayTime(tsdownTime - startTime)}`);
89
+ fs.writeFileSync(path.join(rootDir, config.out.dir, config.out.sef), generateSEF(options), "utf-8");
90
+ const sefTime = Date.now();
91
+ console.info(GREEN_CHECK, BUILD_PREFIX, `built ${config.out.sef} in ${displayTime(sefTime - tsdownTime)}`);
92
+ fs.writeFileSync(path.join(rootDir, config.out.dir, "preview.html"), generatePreview(options), "utf-8");
93
+ const previewTime = Date.now();
94
+ console.info(GREEN_CHECK, BUILD_PREFIX, `built preview.html in ${displayTime(previewTime - sefTime)}`);
95
+ return {
96
+ bundle,
97
+ startTime
98
+ };
99
+ }
100
+ async function buildExtension(options) {
101
+ const { config, rootDir, mode } = options;
102
+ console.info(colors.cyan(`SAMMI Next v${version} ${colors.green(`building "${config.name}" extension in ${BuildMode[mode].toLowerCase()} mode...`)}`));
103
+ let bundle;
104
+ let startTime;
105
+ try {
106
+ const res = await buildOnce(options);
107
+ bundle = res.bundle;
108
+ startTime = res.startTime;
109
+ if (options.mode !== BuildMode.DEV) return bundle;
110
+ console.info(BUILD_PREFIX, colors.cyan("watching for file changes..."));
111
+ const watchPaths = [
112
+ config.entry,
113
+ config.external,
114
+ config.over
115
+ ].filter(Boolean);
116
+ watchPaths[0] = path.dirname(path.join(rootDir, watchPaths[0]));
117
+ const watcher = chokidar.watch(watchPaths, { ignoreInitial: true });
118
+ let timer = null;
119
+ watcher.on("all", (event, p) => {
120
+ console.info(colors.cyan(`${event}: ${p}`));
121
+ if (timer) clearTimeout(timer);
122
+ timer = setTimeout(() => {
123
+ buildOnce(options).then((res$1) => {
124
+ bundle = res$1.bundle;
125
+ startTime = res$1.startTime;
126
+ }).catch((e) => console.error(e));
127
+ }, 100);
128
+ });
129
+ process.on("SIGINT", () => {
130
+ console.info("\nStopping watch mode...");
131
+ watcher.close().then(() => process.exit(0)).catch((e) => {
132
+ console.error(e);
133
+ process.exit(1);
134
+ });
135
+ });
136
+ return watcher;
137
+ } catch (error) {
138
+ if (startTime) {
139
+ console.error(RED_X, BUILD_PREFIX, `Build failed in ${displayTime(Date.now() - startTime)}`);
140
+ startTime = void 0;
141
+ }
142
+ throw error;
143
+ }
144
+ }
145
+
146
+ //#endregion
147
+ export { BuildModes as n, buildExtension as r, BuildMode as t };
148
+ //# sourceMappingURL=build-Dz_JsVU8.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-Dz_JsVU8.mjs","names":["path","VERSION","res"],"sources":["../src/node/utils.ts","../src/node/build.ts"],"sourcesContent":["export function displayTime(time: number): string {\n if (time < 1_000)\n return `${time}ms`;\n\n time = time / 1_000;\n\n if (time < 60)\n return `${time.toFixed(2)}s`\n\n const mins = Math.floor(time / 60);\n const seconds = Math.round(time % 60);\n\n if (seconds === 60)\n return `${mins + 1}m`\n\n return `${mins}m${seconds < 1 ? '' : ` ${seconds}s`}`;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport colors from 'picocolors';\nimport chokidar from 'chokidar';\nimport { ResolvedExtensionConfig } from \"@shared/config-types\";\nimport { build, TsdownBundle } from \"tsdown\";\nimport { BUILD_PREFIX, GLOBAL_NAME, GREEN_CHECK, RED_X, SAMMI_NEXT_PACKAGE_DIR, VERSION } from \"./constants\";\nimport { displayTime } from './utils';\n\nexport enum BuildMode {\n DEV,\n PRODUCTION,\n}\n\nexport const BuildModes = Object.keys(BuildMode);\n\nexport interface BuildOptions {\n config: ResolvedExtensionConfig;\n rootDir: string;\n mode?: BuildMode;\n}\n\nexport type ResolvedBuildOptions = Required<BuildOptions>;\n\nfunction readOptionalFile(path: string): string | undefined {\n if (!fs.existsSync(path)) return;\n\n return fs.readFileSync(path, 'utf-8');\n}\n\nconst CommandRE = /\\w+\\(\\w+,\\s*{\\s*default:/gm;\n\nfunction generateSEF(options: ResolvedBuildOptions): string {\n const { config, rootDir, mode } = options;\n const content = [];\n\n const required_files: {\n header: string,\n content: string,\n }[] = [\n {\n header: \"extension_name\",\n content: config.name,\n },\n {\n header: \"extension_info\",\n content: config.info,\n },\n {\n header: \"extension_version\",\n content: config.version,\n },\n ]\n\n for (const field of required_files) {\n content.push(`[${field.header}]`, field.content, \"\");\n }\n\n const external = readOptionalFile(path.join(rootDir, config.external));\n content.push(\"[insert_external]\", external ? `<div id=\"${config.id}-external\">${external}</div>` : \"\", \"\");\n\n const script = fs.readFileSync(path.join(rootDir, config.entry), \"utf-8\");\n content.push(\"[insert_command]\", CommandRE.test(script) ? `${GLOBAL_NAME}.${config.id}.default()` : \"\", \"\");\n content.push(\"[insert_hook]\", \"\", \"\") // TODO: maybe add hook retro-compatibility\n content.push(\"[insert_script]\", script, \"\");\n\n let over = readOptionalFile(path.join(rootDir, config.over));\n if (over && mode === BuildMode.PRODUCTION) {\n over = JSON.stringify(JSON.parse(over));\n }\n content.push(\"[insert_over]\", over && over != \"{}\" ? over : \"\", \"\");\n return content.join(\"\\n\");\n}\n\nfunction generatePreview(options: ResolvedBuildOptions): string {\n const { config, rootDir } = options;\n\n const external = readOptionalFile(path.join(rootDir, config.external));\n const script = fs.readFileSync(path.join(rootDir, config.entry), \"utf-8\");\n return fs\n .readFileSync(path.join(SAMMI_NEXT_PACKAGE_DIR, \".sammi\", \"preview.blueprint.html\"), \"utf-8\")\n .replace(/{{EXTERNAL}}/g, external ? `<div id=\"${config.id}-external\">${external}</div>` : \"\")\n .replace(/{{SCRIPT}}/g, script);\n}\n\nasync function buildOnce(options: ResolvedBuildOptions) {\n const { config, rootDir, mode } = options;\n\n const startTime = Date.now();\n const bundle = await build({\n entry: [config.entry],\n outDir: path.join(rootDir, config.out.dir),\n platform: 'browser',\n format: 'iife',\n target: ['es2022'],\n sourcemap: false,\n minify: mode === BuildMode.PRODUCTION,\n banner: {\n js: `/* ${config.name} v${config.version} - Built with SAMMI Next v${VERSION} */`,\n },\n noExternal: ['**'],\n outputOptions: {\n entryFileNames: config.out.js,\n extend: true,\n name: `${GLOBAL_NAME}.${config.id}`,\n exports: 'named',\n },\n });\n const tsdownTime = Date.now();\n console.info(GREEN_CHECK, BUILD_PREFIX, `built ${config.out.js} in ${displayTime(tsdownTime - startTime)}`);\n\n fs.writeFileSync(path.join(rootDir, config.out.dir, config.out.sef), generateSEF(options), 'utf-8');\n const sefTime = Date.now();\n console.info(GREEN_CHECK, BUILD_PREFIX, `built ${config.out.sef} in ${displayTime(sefTime - tsdownTime)}`);\n\n fs.writeFileSync(path.join(rootDir, config.out.dir, \"preview.html\"), generatePreview(options), 'utf-8');\n const previewTime = Date.now();\n console.info(GREEN_CHECK, BUILD_PREFIX, `built preview.html in ${displayTime(previewTime - sefTime)}`);\n return { bundle, startTime };\n}\n\nexport async function buildExtension(options: ResolvedBuildOptions) {\n const { config, rootDir, mode } = options;\n\n console.info(\n colors.cyan(\n `SAMMI Next v${VERSION} ${colors.green(\n `building \"${config.name}\" extension in ${BuildMode[mode].toLowerCase()} mode...`\n )}`\n ),\n );\n\n let bundle: TsdownBundle[] | undefined;\n let startTime: number | undefined;\n\n try {\n const res = await buildOnce(options);\n bundle = res.bundle;\n startTime = res.startTime;\n\n if (options.mode !== BuildMode.DEV) return bundle;\n\n console.info(BUILD_PREFIX, colors.cyan(\"watching for file changes...\"));\n\n const watchPaths = [\n config.entry,\n config.external,\n config.over,\n ].filter(Boolean);\n watchPaths[0] = path.dirname(path.join(rootDir, watchPaths[0]));\n\n const watcher = chokidar.watch(watchPaths, { ignoreInitial: true });\n let timer: NodeJS.Timeout | null = null;\n\n watcher.on('all', (event, p) => {\n console.info(colors.cyan(`${event}: ${p}`));\n if (timer)\n clearTimeout(timer);\n\n timer = setTimeout(() => {\n buildOnce(options).then(res => {\n bundle = res.bundle;\n startTime = res.startTime;\n }).catch(e => console.error(e));\n }, 100);\n });\n\n process.on('SIGINT', () => {\n console.info(\"\\nStopping watch mode...\");\n watcher\n .close()\n .then(() => process.exit(0))\n .catch(e => {\n console.error(e);\n process.exit(1);\n });\n });\n return watcher;\n } catch (error) {\n if (startTime) {\n console.error(RED_X, BUILD_PREFIX, `Build failed in ${displayTime(Date.now() - startTime)}`);\n startTime = undefined;\n }\n throw error;\n }\n}\n"],"mappings":"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"}
@@ -0,0 +1,24 @@
1
+ import path from "node:path";
2
+ import colors from "picocolors";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ //#region package.json
6
+ var version = "1.0.0";
7
+
8
+ //#endregion
9
+ //#region src/node/constants.ts
10
+ const DEFAULT_CONFIG_EXTENSIONS = [
11
+ ".mjs",
12
+ ".js",
13
+ ".mts",
14
+ ".ts"
15
+ ];
16
+ const GLOBAL_NAME = "SAMMIExtensions";
17
+ const BUILD_PREFIX = colors.blue("[sammi-next]");
18
+ const GREEN_CHECK = colors.green("✔");
19
+ const RED_X = colors.red("✗");
20
+ const SAMMI_NEXT_PACKAGE_DIR = path.resolve(fileURLToPath(import.meta.url), "../../..");
21
+
22
+ //#endregion
23
+ export { RED_X as a, GREEN_CHECK as i, DEFAULT_CONFIG_EXTENSIONS as n, SAMMI_NEXT_PACKAGE_DIR as o, GLOBAL_NAME as r, version as s, BUILD_PREFIX as t };
24
+ //# sourceMappingURL=constants-CCy1tyHo.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-CCy1tyHo.mjs","names":[],"sources":["../package.json","../src/node/constants.ts"],"sourcesContent":["","import path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport colors from 'picocolors'\n\nexport { version as VERSION } from '../../package.json';\n\nexport const DEFAULT_CONFIG_EXTENSIONS: string[] = [\n '.mjs',\n '.js',\n '.mts',\n '.ts',\n]\n\nexport const GLOBAL_NAME = \"SAMMIExtensions\";\n\nexport const BUILD_PREFIX = colors.blue(\"[sammi-next]\");\nexport const GREEN_CHECK = colors.green('✔');\nexport const RED_X = colors.red('✗');\n\nexport const SAMMI_NEXT_PACKAGE_DIR = path.resolve(\n fileURLToPath(import.meta.url),\n '../../..',\n);\n"],"mappings":";;;;;;;;;ACMA,MAAa,4BAAsC;CAC/C;CACA;CACA;CACA;CACH;AAED,MAAa,cAAc;AAE3B,MAAa,eAAe,OAAO,KAAK,eAAe;AACvD,MAAa,cAAc,OAAO,MAAM,IAAI;AAC5C,MAAa,QAAQ,OAAO,IAAI,IAAI;AAEpC,MAAa,yBAAyB,KAAK,QACvC,cAAc,OAAO,KAAK,IAAI,EAC9B,WACH"}
@@ -0,0 +1,33 @@
1
+ //#region src/runtime/types.d.ts
2
+ /**
3
+ * Represents useful data from the sammi.config.json. Friendly to export.
4
+ */
5
+ interface ExtensionConfig {
6
+ /** This section names your extension, and is visible in SAMMI Bridge and SAMMI Core. Please use alphanumeric characters and spaces only. */
7
+ name: string;
8
+ /** Specify a unique id for your extension here. Please use alphanumeric characters, dashes, and underscores only. */
9
+ id: string;
10
+ /** This section is for descriptive text about the extension, e.g. what the extension does. This information is displayed to the users in SAMMI Bridge-Extensions tab when they hover over the extension name inside the list of installed extensions. */
11
+ info?: string;
12
+ /** Specify your extension version here, using numbers and dots (e.g., 2.01). This is crucial for the automatic version checker in Bridge, which can notify users of updates. */
13
+ version: string;
14
+ }
15
+ /**
16
+ * Interface that represents most of the structures built with SAMMI Next.
17
+ */
18
+ interface SAMMINextExtension {
19
+ readonly default?: () => void;
20
+ readonly _config?: ExtensionConfig;
21
+ readonly [key: string]: unknown;
22
+ }
23
+ //#endregion
24
+ //#region src/runtime/global.d.ts
25
+ declare global {
26
+ /**
27
+ * Global namespace where SAMMI Next stores all the extensions.
28
+ */
29
+ var SAMMIExtensions: Record<string, SAMMINextExtension | undefined>;
30
+ }
31
+ //#endregion
32
+ export { SAMMINextExtension as n, ExtensionConfig as t };
33
+ //# sourceMappingURL=global--vOoG-ft.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global--vOoG-ft.d.mts","names":["SAMMINextExtension","_0","Record","global","SAMMIExtensions","sideEffect"],"sources":["../src/runtime/types.ts","../src/runtime/global.d.ts"],"mappings":";;AAIA;;UAAiB,eAAA;EAAe;EAE5B,IAAA;EAEA;EAAA,EAAA;EAIA;EAFA,IAAA;EAEO;EAAP,OAAA;AAAA;;;;UAMa,kBAAA;EAAA,SACJ,OAAA;EAAA,SACA,OAAA,GAAU,eAAA;EAAA,UACT,GAAA;AAAA;;;QCnBNG,MAAAA;;;;MAIAC,eAAAA,EAAiBF,MAAAA,SAAeF,kBAAAA;AAAAA"}
@@ -0,0 +1,20 @@
1
+ import { ResolvedExtensionConfig } from "../shared/config-types.mjs";
2
+ import * as chokidar0 from "chokidar";
3
+ import { TsdownBundle } from "tsdown";
4
+
5
+ //#region src/node/build.d.ts
6
+ declare enum BuildMode {
7
+ DEV = 0,
8
+ PRODUCTION = 1
9
+ }
10
+ declare const BuildModes: string[];
11
+ interface BuildOptions {
12
+ config: ResolvedExtensionConfig;
13
+ rootDir: string;
14
+ mode?: BuildMode;
15
+ }
16
+ type ResolvedBuildOptions = Required<BuildOptions>;
17
+ declare function buildExtension(options: ResolvedBuildOptions): Promise<TsdownBundle[] | chokidar0.FSWatcher>;
18
+ //#endregion
19
+ export { BuildMode, BuildModes, BuildOptions, ResolvedBuildOptions, buildExtension };
20
+ //# sourceMappingURL=build.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.mts","names":[],"sources":["../../src/node/build.ts"],"mappings":";;;;;aASY,SAAA;EACR,GAAA;EACA,UAAA;AAAA;AAAA,cAGS,UAAA;AAAA,UAEI,YAAA;EACb,MAAA,EAAQ,uBAAA;EACR,OAAA;EACA,IAAA,GAAO,SAAA;AAAA;AAAA,KAGC,oBAAA,GAAuB,QAAA,CAAS,YAAA;AAAA,iBAmGtB,cAAA,CAAe,OAAA,EAAS,oBAAA,GAAoB,OAAA,CAAA,YAAA,KAAA,SAAA,CAAA,SAAA"}
@@ -0,0 +1,4 @@
1
+ import "../constants-CCy1tyHo.mjs";
2
+ import { n as BuildModes, r as buildExtension, t as BuildMode } from "../build-Dz_JsVU8.mjs";
3
+
4
+ export { BuildMode, BuildModes, buildExtension };
@@ -0,0 +1,13 @@
1
+ //#region src/node/cli.d.ts
2
+ interface GlobalCLIOptions {
3
+ m?: string;
4
+ mode?: string;
5
+ }
6
+ interface BuildCLIOptions {
7
+ outDir?: string;
8
+ outJs?: string;
9
+ outSef?: string;
10
+ }
11
+ //#endregion
12
+ export { BuildCLIOptions, GlobalCLIOptions };
13
+ //# sourceMappingURL=cli.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.mts","names":[],"sources":["../../src/node/cli.ts"],"mappings":";UAOiB,gBAAA;EACb,CAAA;EACA,IAAA;AAAA;AAAA,UAsBa,eAAA;EACb,MAAA;EACA,KAAA;EACA,MAAA;AAAA"}
@@ -0,0 +1,61 @@
1
+ import "../constants-CCy1tyHo.mjs";
2
+ import { n as BuildModes, r as buildExtension, t as BuildMode } from "../build-Dz_JsVU8.mjs";
3
+ import { resolveBuildConfig } from "./config.mjs";
4
+ import cac from "cac";
5
+ import colors from "picocolors";
6
+
7
+ //#region src/node/cli.ts
8
+ const cli = cac("sammi-next");
9
+ const filterDuplicateOptions = (options) => {
10
+ for (const [key, value] of Object.entries(options)) {
11
+ if (!Array.isArray(value)) continue;
12
+ options[key] = value[value.length - 1];
13
+ }
14
+ };
15
+ function cleanGlobalCLIOptions(options) {
16
+ const ret = { ...options };
17
+ delete ret.m;
18
+ delete ret.mode;
19
+ return ret;
20
+ }
21
+ cli.option("-m, --mode <mode>", "[string] set build mode");
22
+ cli.command("[root]", "build extension").option("--outDir <dir>", "[string] output directory (default: \"dist\")").option("--outJs <name>", "[string] output file name for the JS (default: extension.js)").option("--outSef <name>", "[string] output file name for the SEF (default: extension.sef)").action(async (root, options) => {
23
+ filterDuplicateOptions(options);
24
+ const buildOptions = cleanGlobalCLIOptions(options);
25
+ const mode = BuildModes.findIndex((m) => {
26
+ return m.toLowerCase() === (options.mode || BuildMode[BuildMode.PRODUCTION]).toLowerCase();
27
+ });
28
+ if (mode < 0) {
29
+ console.error(`Invalid mode: ${options.mode}. It must be one of: ${BuildModes.join(", ")}`);
30
+ process.exit(1);
31
+ }
32
+ try {
33
+ await buildExtension(await resolveBuildConfig(root, mode, buildOptions));
34
+ } catch (e) {
35
+ const error = e;
36
+ console.error(colors.red(`error during build:\n${error.stack}`));
37
+ process.exit(1);
38
+ }
39
+ });
40
+ cli.command("dev [root]", "build extension in dev mode").option("--outDir <dir>", "[string] output directory (default: \"dist\")").option("--outJs <name>", "[string] output file name for the JS (default: extension.js)").option("--outSef <name>", "[string] output file name for the SEF (default: extension.sef)").action(async (root, options) => {
41
+ filterDuplicateOptions(options);
42
+ const buildOptions = cleanGlobalCLIOptions(options);
43
+ const mode = BuildModes.findIndex((m) => {
44
+ return m.toLowerCase() === (options.mode || BuildMode[BuildMode.DEV]).toLowerCase();
45
+ });
46
+ if (mode < 0) {
47
+ console.error(`Invalid mode: ${options.mode}. It must be one of: ${BuildModes.join(", ")}`);
48
+ process.exit(1);
49
+ }
50
+ try {
51
+ await buildExtension(await resolveBuildConfig(root, mode, buildOptions));
52
+ } catch (e) {
53
+ const error = e;
54
+ console.error(colors.red(`error during build:\n${error.stack}`));
55
+ process.exit(1);
56
+ }
57
+ });
58
+
59
+ //#endregion
60
+ export { };
61
+ //# sourceMappingURL=cli.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.mjs","names":[],"sources":["../../src/node/cli.ts"],"sourcesContent":["import cac from \"cac\";\nimport { buildExtension, BuildMode, BuildModes } from \"./build\";\nimport colors from 'picocolors';\nimport { resolveBuildConfig } from \"./config\";\n\nconst cli = cac('sammi-next');\n\nexport interface GlobalCLIOptions {\n m?: string\n mode?: string\n}\n\nconst filterDuplicateOptions = <T extends object>(options: T) => {\n for (const [key, value] of Object.entries(options)) {\n if (!Array.isArray(value)) continue;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n options[key as keyof T] = value[value.length - 1];\n }\n};\n\nfunction cleanGlobalCLIOptions<Options extends GlobalCLIOptions>(options: Options): Omit<Options, keyof GlobalCLIOptions> {\n const ret = { ...options };\n delete ret.m\n delete ret.mode\n\n return ret;\n}\n\ncli.option('-m, --mode <mode>', '[string] set build mode');\n\nexport interface BuildCLIOptions {\n outDir?: string\n outJs?: string\n outSef?: string\n}\n\ncli\n .command('[root]', 'build extension')\n .option('--outDir <dir>', '[string] output directory (default: \"dist\")')\n .option('--outJs <name>', '[string] output file name for the JS (default: extension.js)')\n .option('--outSef <name>', '[string] output file name for the SEF (default: extension.sef)')\n .action(\n async (\n root: string,\n options: GlobalCLIOptions,\n ) => {\n filterDuplicateOptions(options);\n\n const buildOptions: BuildCLIOptions = cleanGlobalCLIOptions(options);\n const mode = BuildModes.findIndex(m => {\n return m.toLowerCase() === (options.mode || BuildMode[BuildMode.PRODUCTION]).toLowerCase();\n });\n if (mode < 0) {\n console.error(`Invalid mode: ${options.mode}. It must be one of: ${BuildModes.join(', ')}`);\n process.exit(1);\n }\n\n try {\n const buildConfig = await resolveBuildConfig(\n root,\n mode,\n buildOptions,\n );\n\n await buildExtension(buildConfig);\n } catch (e) {\n const error = e as Error;\n console.error(colors.red(`error during build:\\n${error.stack}`));\n process.exit(1);\n }\n }\n )\n\ncli\n .command('dev [root]', 'build extension in dev mode')\n .option('--outDir <dir>', '[string] output directory (default: \"dist\")')\n .option('--outJs <name>', '[string] output file name for the JS (default: extension.js)')\n .option('--outSef <name>', '[string] output file name for the SEF (default: extension.sef)')\n .action(\n async (\n root: string,\n options: GlobalCLIOptions,\n ) => {\n filterDuplicateOptions(options);\n\n const buildOptions: BuildCLIOptions = cleanGlobalCLIOptions(options);\n const mode = BuildModes.findIndex(m => {\n return m.toLowerCase() === (options.mode || BuildMode[BuildMode.DEV]).toLowerCase();\n });\n if (mode < 0) {\n console.error(`Invalid mode: ${options.mode}. It must be one of: ${BuildModes.join(', ')}`);\n process.exit(1);\n }\n\n try {\n const buildConfig = await resolveBuildConfig(\n root,\n mode,\n buildOptions,\n );\n\n await buildExtension(buildConfig);\n } catch (e) {\n const error = e as Error;\n console.error(colors.red(`error during build:\\n${error.stack}`));\n process.exit(1);\n }\n }\n )\n"],"mappings":";;;;;;;AAKA,MAAM,MAAM,IAAI,aAAa;AAO7B,MAAM,0BAA4C,YAAe;AAC7D,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,EAAE;AAChD,MAAI,CAAC,MAAM,QAAQ,MAAM,CAAE;AAG3B,UAAQ,OAAkB,MAAM,MAAM,SAAS;;;AAIvD,SAAS,sBAAwD,SAAyD;CACtH,MAAM,MAAM,EAAE,GAAG,SAAS;AAC1B,QAAO,IAAI;AACX,QAAO,IAAI;AAEX,QAAO;;AAGX,IAAI,OAAO,qBAAqB,0BAA0B;AAQ1D,IACK,QAAQ,UAAU,kBAAkB,CACpC,OAAO,kBAAkB,gDAA8C,CACvE,OAAO,kBAAkB,+DAA+D,CACxF,OAAO,mBAAmB,iEAAiE,CAC3F,OACG,OACI,MACA,YACC;AACD,wBAAuB,QAAQ;CAE/B,MAAM,eAAgC,sBAAsB,QAAQ;CACpE,MAAM,OAAO,WAAW,WAAU,MAAK;AACnC,SAAO,EAAE,aAAa,MAAM,QAAQ,QAAQ,UAAU,UAAU,aAAa,aAAa;GAC5F;AACF,KAAI,OAAO,GAAG;AACV,UAAQ,MAAM,iBAAiB,QAAQ,KAAK,uBAAuB,WAAW,KAAK,KAAK,GAAG;AAC3F,UAAQ,KAAK,EAAE;;AAGnB,KAAI;AAOA,QAAM,eANc,MAAM,mBACtB,MACA,MACA,aACH,CAEgC;UAC5B,GAAG;EACR,MAAM,QAAQ;AACd,UAAQ,MAAM,OAAO,IAAI,wBAAwB,MAAM,QAAQ,CAAC;AAChE,UAAQ,KAAK,EAAE;;EAG1B;AAEL,IACK,QAAQ,cAAc,8BAA8B,CACpD,OAAO,kBAAkB,gDAA8C,CACvE,OAAO,kBAAkB,+DAA+D,CACxF,OAAO,mBAAmB,iEAAiE,CAC3F,OACG,OACI,MACA,YACC;AACD,wBAAuB,QAAQ;CAE/B,MAAM,eAAgC,sBAAsB,QAAQ;CACpE,MAAM,OAAO,WAAW,WAAU,MAAK;AACnC,SAAO,EAAE,aAAa,MAAM,QAAQ,QAAQ,UAAU,UAAU,MAAM,aAAa;GACrF;AACF,KAAI,OAAO,GAAG;AACV,UAAQ,MAAM,iBAAiB,QAAQ,KAAK,uBAAuB,WAAW,KAAK,KAAK,GAAG;AAC3F,UAAQ,KAAK,EAAE;;AAGnB,KAAI;AAOA,QAAM,eANc,MAAM,mBACtB,MACA,MACA,aACH,CAEgC;UAC5B,GAAG;EACR,MAAM,QAAQ;AACd,UAAQ,MAAM,OAAO,IAAI,wBAAwB,MAAM,QAAQ,CAAC;AAChE,UAAQ,KAAK,EAAE;;EAG1B"}
@@ -0,0 +1,11 @@
1
+ import { ExtensionConfig, ResolvedExtensionConfig } from "../shared/config-types.mjs";
2
+ import { BuildMode, BuildOptions } from "./build.mjs";
3
+ import { BuildCLIOptions } from "./cli.mjs";
4
+
5
+ //#region src/node/config.d.ts
6
+ declare function loadConfig(rootDir: string): Promise<ExtensionConfig>;
7
+ declare function resolveExtensionConfig(config: ExtensionConfig, rootDir: string): ResolvedExtensionConfig;
8
+ declare function resolveBuildConfig(root: string, mode: BuildMode, build_cli: BuildCLIOptions): Promise<Required<BuildOptions>>;
9
+ //#endregion
10
+ export { loadConfig, resolveBuildConfig, resolveExtensionConfig };
11
+ //# sourceMappingURL=config.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.mts","names":[],"sources":["../../src/node/config.ts"],"mappings":";;;;;iBAmGsB,UAAA,CAAW,OAAA,WAAe,OAAA,CAAA,eAAA;AAAA,iBA6ChC,sBAAA,CAAuB,MAAA,EAAQ,eAAA,EAAiB,OAAA,WAAkB,uBAAA;AAAA,iBA4B5D,kBAAA,CAClB,IAAA,UACA,IAAA,EAAM,SAAA,EACN,SAAA,EAAW,eAAA,GAAe,OAAA,CAAA,QAAA,CAAA,YAAA"}
@@ -0,0 +1,159 @@
1
+ import { n as DEFAULT_CONFIG_EXTENSIONS } from "../constants-CCy1tyHo.mjs";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import Ajv from "ajv";
5
+
6
+ //#region src/node/config.ts
7
+ const ajv = new Ajv();
8
+ ajv.addKeyword({
9
+ keyword: "fileExists",
10
+ validate: (_schema, data) => {
11
+ if (!data) return true;
12
+ return fs.existsSync(data);
13
+ },
14
+ errors: false
15
+ });
16
+ const configValidator = ajv.compile({
17
+ type: "object",
18
+ properties: {
19
+ id: {
20
+ type: "string",
21
+ minLength: 1,
22
+ pattern: "^[a-zA-Z0-9-_]+$"
23
+ },
24
+ name: {
25
+ type: "string",
26
+ minLength: 1,
27
+ pattern: "^[a-zA-Z0-9 -_]+$"
28
+ },
29
+ info: {
30
+ type: "string",
31
+ default: "",
32
+ nullable: true
33
+ },
34
+ version: {
35
+ type: "string",
36
+ minLength: 1,
37
+ pattern: "^\\d+(?:\\.\\d+)*(?:-.*)?$"
38
+ },
39
+ entry: {
40
+ type: "string",
41
+ minLength: 1,
42
+ fileExists: true
43
+ },
44
+ external: {
45
+ type: "string",
46
+ minLength: 1,
47
+ fileExists: true,
48
+ nullable: true
49
+ },
50
+ over: {
51
+ type: "string",
52
+ minLength: 1,
53
+ fileExists: true,
54
+ nullable: true
55
+ },
56
+ out: {
57
+ type: "object",
58
+ properties: {
59
+ dir: {
60
+ type: "string",
61
+ minLength: 1,
62
+ pattern: "^[^<>:\"|?*]+$",
63
+ default: "dist",
64
+ nullable: true
65
+ },
66
+ js: {
67
+ type: "string",
68
+ minLength: 4,
69
+ pattern: "^[\\w\\-. ]+\\.js$",
70
+ default: "extension.js",
71
+ nullable: true
72
+ },
73
+ sef: {
74
+ type: "string",
75
+ minLength: 5,
76
+ pattern: "^[\\w\\-. ]+\\.sef$",
77
+ default: "extension.sef",
78
+ nullable: true
79
+ }
80
+ },
81
+ required: [],
82
+ nullable: true,
83
+ additionalProperties: false
84
+ }
85
+ },
86
+ required: [
87
+ "name",
88
+ "id",
89
+ "version",
90
+ "entry"
91
+ ],
92
+ additionalProperties: false
93
+ });
94
+ async function loadConfig(rootDir) {
95
+ for (const ext of DEFAULT_CONFIG_EXTENSIONS) {
96
+ const configPath = path.join(rootDir, `sammi.config${ext}`);
97
+ if (!fs.existsSync(configPath)) continue;
98
+ try {
99
+ const { createJiti } = await import("jiti");
100
+ return validateExtensionConfig(await createJiti(rootDir, {
101
+ interopDefault: true,
102
+ moduleCache: true
103
+ }).import(configPath, { default: true }), configPath);
104
+ } catch (error) {
105
+ throw new Error(`Error loading ${configPath}: ${error instanceof Error ? error.message : String(error)}`);
106
+ }
107
+ }
108
+ const jsonPath = path.join(rootDir, "sammi.config.json");
109
+ if (fs.existsSync(jsonPath)) try {
110
+ const raw = fs.readFileSync(jsonPath, "utf-8");
111
+ return validateExtensionConfig(JSON.parse(raw), jsonPath);
112
+ } catch (error) {
113
+ throw new Error(`Error loading ${jsonPath}: ${error instanceof Error ? error.message : String(error)}`);
114
+ }
115
+ throw new Error("SAMMI Next extension config file not found in the root dir.");
116
+ }
117
+ function validateExtensionConfig(config, configPath) {
118
+ if (!configValidator(config)) {
119
+ const errors = configValidator.errors?.map((err) => ` - ${err.instancePath} ${err.message}`).join("\n");
120
+ throw new Error(`Invalid config from ${configPath}:\n${errors}`);
121
+ }
122
+ return config;
123
+ }
124
+ function resolveExtensionConfig(config, rootDir) {
125
+ const resolved = {
126
+ id: config.id,
127
+ name: config.name,
128
+ version: config.version,
129
+ info: config.info || "",
130
+ entry: path.resolve(rootDir, config.entry),
131
+ external: config.external ? path.resolve(rootDir, config.external) : "",
132
+ over: config.over ? path.resolve(rootDir, config.over) : "",
133
+ out: {
134
+ dir: config.out?.dir || "dist",
135
+ js: config.out?.js || "extension.js",
136
+ sef: config.out?.sef || "extension.sef"
137
+ }
138
+ };
139
+ if (!fs.existsSync(resolved.entry)) throw new Error(`Entry file not found: ${resolved.entry}`);
140
+ if (resolved.external && !fs.existsSync(resolved.external)) throw new Error(`External file not found: ${resolved.external}`);
141
+ if (resolved.over && !fs.existsSync(resolved.over)) throw new Error(`Over file not found: ${resolved.over}`);
142
+ return resolved;
143
+ }
144
+ async function resolveBuildConfig(root, mode, build_cli) {
145
+ const config = await loadConfig(root);
146
+ config.out ??= {};
147
+ config.out.dir = build_cli.outDir ?? config.out.dir;
148
+ config.out.js = build_cli.outJs ?? config.out.js;
149
+ config.out.sef = build_cli.outSef ?? config.out.sef;
150
+ return {
151
+ rootDir: root,
152
+ mode,
153
+ config: resolveExtensionConfig(config, root)
154
+ };
155
+ }
156
+
157
+ //#endregion
158
+ export { loadConfig, resolveBuildConfig, resolveExtensionConfig };
159
+ //# sourceMappingURL=config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.mjs","names":[],"sources":["../../src/node/config.ts"],"sourcesContent":["\n\nimport { ExtensionConfig, ResolvedExtensionConfig } from \"@shared/config-types\";\nimport Ajv, { JSONSchemaType } from \"ajv\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { DEFAULT_CONFIG_EXTENSIONS } from \"./constants\";\nimport { BuildCLIOptions } from \"./cli\";\nimport { BuildMode, ResolvedBuildOptions } from \"./build\";\n\nconst ajv = new Ajv();\n\najv.addKeyword({\n keyword: \"fileExists\",\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n validate: (_schema: any, data: any) => {\n if (!data) return true;\n\n return fs.existsSync(data as string);\n },\n errors: false\n});\n\nconst schema: JSONSchemaType<ExtensionConfig> = {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n minLength: 1,\n pattern: \"^[a-zA-Z0-9-_]+$\",\n },\n name: {\n type: \"string\",\n minLength: 1,\n pattern: \"^[a-zA-Z0-9 -_]+$\",\n },\n info: {\n type: \"string\",\n default: \"\",\n nullable: true,\n },\n version: {\n type: \"string\",\n minLength: 1,\n pattern: \"^\\\\d+(?:\\\\.\\\\d+)*(?:-.*)?$\",\n },\n entry: {\n type: \"string\",\n minLength: 1,\n fileExists: true,\n },\n external: {\n type: \"string\",\n minLength: 1,\n fileExists: true,\n nullable: true,\n },\n over: {\n type: \"string\",\n minLength: 1,\n fileExists: true,\n nullable: true,\n },\n out: {\n type: \"object\",\n properties: {\n dir: {\n type: \"string\",\n minLength: 1,\n pattern: \"^[^<>:\\\"|?*]+$\",\n default: \"dist\",\n nullable: true,\n },\n js: {\n type: \"string\",\n minLength: 4,\n pattern: \"^[\\\\w\\\\-. ]+\\\\.js$\",\n default: \"extension.js\",\n nullable: true,\n },\n sef: {\n type: \"string\",\n minLength: 5,\n pattern: \"^[\\\\w\\\\-. ]+\\\\.sef$\",\n default: \"extension.sef\",\n nullable: true,\n }\n },\n required: [],\n nullable: true,\n additionalProperties: false,\n }\n },\n required: [\"name\", \"id\", \"version\", \"entry\"],\n additionalProperties: false,\n};\n\nconst configValidator = ajv.compile(schema);\n\nexport async function loadConfig(rootDir: string) {\n for (const ext of DEFAULT_CONFIG_EXTENSIONS) {\n const configPath = path.join(rootDir, `sammi.config${ext}`);\n\n if (!fs.existsSync(configPath)) continue;\n\n try {\n const { createJiti } = await import('jiti');\n const jiti = createJiti(rootDir, {\n interopDefault: true,\n moduleCache: true,\n });\n\n const config = await jiti.import(configPath, { default: true });\n\n return validateExtensionConfig(config, configPath);\n } catch (error) {\n throw new Error(`Error loading ${configPath}: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n const jsonPath = path.join(rootDir, 'sammi.config.json');\n if (fs.existsSync(jsonPath)) {\n try {\n const raw = fs.readFileSync(jsonPath, 'utf-8');\n const config = JSON.parse(raw) as unknown;\n return validateExtensionConfig(config, jsonPath);\n } catch (error) {\n throw new Error(`Error loading ${jsonPath}: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n throw new Error('SAMMI Next extension config file not found in the root dir.');\n}\n\n\nfunction validateExtensionConfig(config: unknown, configPath: string): ExtensionConfig {\n if (!configValidator(config)) {\n const errors = configValidator.errors?.map(err => ` - ${err.instancePath} ${err.message}`).join('\\n');\n throw new Error(`Invalid config from ${configPath}:\\n${errors}`);\n }\n\n return config;\n}\n\nexport function resolveExtensionConfig(config: ExtensionConfig, rootDir: string): ResolvedExtensionConfig {\n const resolved: ResolvedExtensionConfig = {\n id: config.id,\n name: config.name,\n version: config.version,\n info: config.info || '',\n entry: path.resolve(rootDir, config.entry),\n external: config.external ? path.resolve(rootDir, config.external) : '',\n over: config.over ? path.resolve(rootDir, config.over) : '',\n out: {\n dir: config.out?.dir || 'dist',\n js: config.out?.js || 'extension.js',\n sef: config.out?.sef || 'extension.sef',\n },\n };\n\n if (!fs.existsSync(resolved.entry))\n throw new Error(`Entry file not found: ${resolved.entry}`);\n\n if (resolved.external && !fs.existsSync(resolved.external))\n throw new Error(`External file not found: ${resolved.external}`);\n\n if (resolved.over && !fs.existsSync(resolved.over))\n throw new Error(`Over file not found: ${resolved.over}`);\n\n return resolved;\n}\n\nexport async function resolveBuildConfig(\n root: string,\n mode: BuildMode,\n build_cli: BuildCLIOptions,\n) {\n const config = await loadConfig(root);\n\n config.out ??= {};\n\n config.out.dir = build_cli.outDir ?? config.out.dir;\n config.out.js = build_cli.outJs ?? config.out.js;\n config.out.sef = build_cli.outSef ?? config.out.sef;\n\n const resolvedConfig = resolveExtensionConfig(config, root);\n\n const resolved: ResolvedBuildOptions = {\n rootDir: root,\n mode,\n config: resolvedConfig\n }\n return resolved;\n}\n"],"mappings":"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"}
@@ -0,0 +1,102 @@
1
+ import { n as SAMMINextExtension, t as ExtensionConfig } from "../global--vOoG-ft.mjs";
2
+ import { ExtensionConfig as ExtensionConfig$1 } from "../shared/config-types.mjs";
3
+ import "sammi-bridge-types";
4
+
5
+ //#region src/runtime/index.d.ts
6
+ interface initExtensionOptions {
7
+ /**
8
+ * Whether to skip the process of proxying your extension.
9
+ *
10
+ * Warning: this allows other scripts to modify your exports.
11
+ *
12
+ * @default false
13
+ */
14
+ skipProxying?: boolean;
15
+ }
16
+ /**
17
+ * Removes unnecessary data from a raw extension config object and parses it into an ExtensionConfig.
18
+ *
19
+ * Exports the config through the `SAMMIExtensions` namespace with the `_config` key.
20
+ *
21
+ * Generates a Proxy of the extension object to avoid other scripts trying to overwrite it.
22
+ *
23
+ * @example
24
+ * const extension_config = SAMMIExtensions['extension-id']._config;
25
+ *
26
+ * @param config Unparsed config object.
27
+ * @param options Whether to skip the process of proxying your extension (allowing other scripts to modify your exports).
28
+ * @returns Parsed and cleaned config.
29
+ */
30
+ declare function initExtension(config: Record<string, any>, options?: initExtensionOptions): ExtensionConfig;
31
+ /**
32
+ * Retrieves an [insert_external] section by its extension id.
33
+ *
34
+ * ### Original documentation from https://sammi.solutions/extensions/build
35
+ * This section appears inside the extension’s tab in Bridge, and it provides a visual interface for the extension if needed. It’s written in HTML and CSS.
36
+ *
37
+ * @example
38
+ * const EXTERNAL = getExternalSection(config.id);
39
+ * EXTERNAL.querySelector("button")?.addEventListener('click', () => console.log('Hello world!'));
40
+ *
41
+ * @param extension_id The id of the SAMMI Next extension to retrieve its [insert_external] section.
42
+ * @returns the div element that wraps your extension.
43
+ */
44
+ declare function getExternalSection(extension_id: string): HTMLDivElement;
45
+ interface insertCommandSectionOptions {
46
+ /**
47
+ * Whether to wait for `sammiclient` to exist.
48
+ * This is enabled by default because every extension that uses `SAMMI` depends on `sammiclient`.
49
+ * You can disable it if your [insert_command] section doesn't use neither `SAMMI` nor `sammiclient`.
50
+ *
51
+ * @default true
52
+ */
53
+ waitForSammiclient?: boolean;
54
+ /**
55
+ * Whether to wait for `SAMMIExtensions` to exist.
56
+ * You must set this to `true` if you use the `SAMMIExtensions` namespace inside your [insert_command] section.
57
+ *
58
+ * @default false
59
+ */
60
+ waitForSAMMIExtensions?: boolean;
61
+ }
62
+ /**
63
+ * Generates your [insert_command] section.
64
+ * This should be used in the default export of your extension.
65
+ *
66
+ * By default, it wraps your callback to wait for `sammiclient` and `SAMMI` are initialized.
67
+ * Its behavior can be changed in the options param.
68
+ *
69
+ * ### Original documentation from https://sammi.solutions/extensions/build
70
+ * In this section, you can define Extension Commands.
71
+ * These commands will be available to users in SAMMI Core when they install your extension.
72
+ * You can define multiple commands in this section.
73
+ * Refer to the SAMMI Bridge documentation for Extension Command details.
74
+ * In this section, you can also automatically call your main extension function that should run as soon as SAMMI connects to Bridge.
75
+ *
76
+ * @example
77
+ * export default insertCommandSection(() => {
78
+ * SAMMI.extCommand("Extension Sample Command", 3355443, 52).catch(e => console.error(e));
79
+ * sammiclient.on("Extension Sample Command", () => {
80
+ * const handler = async () => {
81
+ * await SAMMI.notification('Command Sample');
82
+ * };
83
+ * handler().catch((e) => console.error(e));
84
+ * });
85
+ * });
86
+ * export default insertCommandSection(
87
+ * () => console.log("Hello world"),
88
+ * { waitForSammiclient: false }
89
+ * );
90
+ * export default insertCommandSection(
91
+ * () => console.log(SAMMIExtensions["extension-id"]),
92
+ * { waitForSAMMIExtensions: true }
93
+ * );
94
+ *
95
+ * @param callback A callback with the logic that you will insert in your [insert_command] section.
96
+ * @param options The initialization options.
97
+ * @returns wrapped export default callback
98
+ */
99
+ declare function insertCommandSection(callback: () => void, options?: insertCommandSectionOptions): () => void;
100
+ //#endregion
101
+ export { type ExtensionConfig, type ExtensionConfig$1 as FullExtensionConfig, type SAMMINextExtension, getExternalSection, initExtension, insertCommandSection };
102
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/runtime/index.ts"],"mappings":";;;;;UAOU,oBAAA;;AALgC;;;;;AAgC1C;EAnBI,YAAA;AAAA;;;;;;;;;;;;;AAgFJ;;iBA7DgB,aAAA,CAEZ,MAAA,EAAQ,MAAA,eACR,OAAA,GAAS,oBAAA,GAGV,eAAA;;;AAyDF;;;;;AA4DD;;;;;;iBA9DgB,kBAAA,CAAmB,YAAA,WAAuB,cAAA;AAAA,UAIhD,2BAAA;EA+DL;;;;;;;EAvDD,kBAAA;;;;;;;EAOA,sBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2CY,oBAAA,CACZ,QAAA,cACA,OAAA,GAAS,2BAAA"}
@@ -0,0 +1,133 @@
1
+ import "../global--vOoG-ft.d.mts";
2
+ import "sammi-bridge-types";
3
+
4
+ //#region src/runtime/index.ts
5
+ const PROXY_PREFIX = "[SAMMI-NEXT-PROXY]";
6
+ const defaultInitExtensionOptions = { skipProxying: false };
7
+ /**
8
+ * Removes unnecessary data from a raw extension config object and parses it into an ExtensionConfig.
9
+ *
10
+ * Exports the config through the `SAMMIExtensions` namespace with the `_config` key.
11
+ *
12
+ * Generates a Proxy of the extension object to avoid other scripts trying to overwrite it.
13
+ *
14
+ * @example
15
+ * const extension_config = SAMMIExtensions['extension-id']._config;
16
+ *
17
+ * @param config Unparsed config object.
18
+ * @param options Whether to skip the process of proxying your extension (allowing other scripts to modify your exports).
19
+ * @returns Parsed and cleaned config.
20
+ */
21
+ function initExtension(config, options = { skipProxying: false }) {
22
+ let response = {
23
+ id: config.id,
24
+ name: config.name,
25
+ version: config.version,
26
+ info: config.info
27
+ };
28
+ window.SAMMIExtensions = window.SAMMIExtensions || {};
29
+ SAMMIExtensions[response.id] = SAMMIExtensions[response.id] || {};
30
+ if (SAMMIExtensions[response.id]?._config) throw new Error("The extension with the provided id was already initialized");
31
+ const settings = Object.assign(defaultInitExtensionOptions, options);
32
+ if (!settings.skipProxying) response = Object.freeze(response);
33
+ SAMMIExtensions[response.id]._config ??= response;
34
+ if (settings.skipProxying) return response;
35
+ SAMMIExtensions[response.id] = new Proxy(SAMMIExtensions[response.id], {
36
+ set(target, prop) {
37
+ console.error(PROXY_PREFIX, ": Blocked setting value of:", prop, "on:", target._config?.id);
38
+ return true;
39
+ },
40
+ defineProperty(target, property) {
41
+ console.error(PROXY_PREFIX, ": Blocked property redefinition of:", property, "on:", target._config?.id);
42
+ return true;
43
+ },
44
+ deleteProperty(target, p) {
45
+ console.error(PROXY_PREFIX, ": Blocked deletion of:", p, "on:", target._config?.id);
46
+ return true;
47
+ },
48
+ setPrototypeOf(target) {
49
+ console.error(PROXY_PREFIX, ": Blocked changing prototype of:", target._config?.id);
50
+ return true;
51
+ }
52
+ });
53
+ return response;
54
+ }
55
+ /**
56
+ * Retrieves an [insert_external] section by its extension id.
57
+ *
58
+ * ### Original documentation from https://sammi.solutions/extensions/build
59
+ * This section appears inside the extension’s tab in Bridge, and it provides a visual interface for the extension if needed. It’s written in HTML and CSS.
60
+ *
61
+ * @example
62
+ * const EXTERNAL = getExternalSection(config.id);
63
+ * EXTERNAL.querySelector("button")?.addEventListener('click', () => console.log('Hello world!'));
64
+ *
65
+ * @param extension_id The id of the SAMMI Next extension to retrieve its [insert_external] section.
66
+ * @returns the div element that wraps your extension.
67
+ */
68
+ function getExternalSection(extension_id) {
69
+ return document.getElementById(`${extension_id}-external`);
70
+ }
71
+ const defaultInsertCommandSectionOptions = {
72
+ waitForSammiclient: true,
73
+ waitForSAMMIExtensions: false
74
+ };
75
+ /**
76
+ * Generates your [insert_command] section.
77
+ * This should be used in the default export of your extension.
78
+ *
79
+ * By default, it wraps your callback to wait for `sammiclient` and `SAMMI` are initialized.
80
+ * Its behavior can be changed in the options param.
81
+ *
82
+ * ### Original documentation from https://sammi.solutions/extensions/build
83
+ * In this section, you can define Extension Commands.
84
+ * These commands will be available to users in SAMMI Core when they install your extension.
85
+ * You can define multiple commands in this section.
86
+ * Refer to the SAMMI Bridge documentation for Extension Command details.
87
+ * In this section, you can also automatically call your main extension function that should run as soon as SAMMI connects to Bridge.
88
+ *
89
+ * @example
90
+ * export default insertCommandSection(() => {
91
+ * SAMMI.extCommand("Extension Sample Command", 3355443, 52).catch(e => console.error(e));
92
+ * sammiclient.on("Extension Sample Command", () => {
93
+ * const handler = async () => {
94
+ * await SAMMI.notification('Command Sample');
95
+ * };
96
+ * handler().catch((e) => console.error(e));
97
+ * });
98
+ * });
99
+ * export default insertCommandSection(
100
+ * () => console.log("Hello world"),
101
+ * { waitForSammiclient: false }
102
+ * );
103
+ * export default insertCommandSection(
104
+ * () => console.log(SAMMIExtensions["extension-id"]),
105
+ * { waitForSAMMIExtensions: true }
106
+ * );
107
+ *
108
+ * @param callback A callback with the logic that you will insert in your [insert_command] section.
109
+ * @param options The initialization options.
110
+ * @returns wrapped export default callback
111
+ */
112
+ function insertCommandSection(callback, options = {
113
+ waitForSammiclient: true,
114
+ waitForSAMMIExtensions: false
115
+ }) {
116
+ const settings = Object.assign(defaultInsertCommandSectionOptions, options);
117
+ const wrapper = () => {
118
+ if (!sammiclient && settings.waitForSammiclient) {
119
+ setTimeout(wrapper, 0);
120
+ return;
121
+ }
122
+ if (!SAMMIExtensions && settings.waitForSAMMIExtensions) {
123
+ setTimeout(wrapper, 0);
124
+ return;
125
+ }
126
+ callback();
127
+ };
128
+ return wrapper;
129
+ }
130
+
131
+ //#endregion
132
+ export { getExternalSection, initExtension, insertCommandSection };
133
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/runtime/index.ts"],"sourcesContent":["import \"sammi-bridge-types\";\nimport \"./global.d.ts\";\nimport { ExtensionConfig } from \"./types\";\n\n\nconst PROXY_PREFIX = \"[SAMMI-NEXT-PROXY]\";\n\ninterface initExtensionOptions {\n /**\n * Whether to skip the process of proxying your extension.\n *\n * Warning: this allows other scripts to modify your exports.\n *\n * @default false\n */\n skipProxying?: boolean\n}\nconst defaultInitExtensionOptions: initExtensionOptions = {\n skipProxying: false,\n}\n/**\n * Removes unnecessary data from a raw extension config object and parses it into an ExtensionConfig.\n *\n * Exports the config through the `SAMMIExtensions` namespace with the `_config` key.\n *\n * Generates a Proxy of the extension object to avoid other scripts trying to overwrite it.\n *\n * @example\n * const extension_config = SAMMIExtensions['extension-id']._config;\n *\n * @param config Unparsed config object.\n * @param options Whether to skip the process of proxying your extension (allowing other scripts to modify your exports).\n * @returns Parsed and cleaned config.\n */\nexport function initExtension(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: Record<string, any>,\n options: initExtensionOptions = {\n skipProxying: false,\n }\n): ExtensionConfig {\n let response: ExtensionConfig = {\n id: config.id as string,\n name: config.name as string,\n version: config.version as string,\n info: config.info as string | undefined,\n };\n\n window.SAMMIExtensions = window.SAMMIExtensions || {};\n SAMMIExtensions[response.id] = SAMMIExtensions[response.id] || {};\n if (SAMMIExtensions[response.id]?._config)\n throw new Error('The extension with the provided id was already initialized');\n\n const settings = Object.assign(defaultInitExtensionOptions, options);\n if (!settings.skipProxying)\n response = Object.freeze(response);\n\n // @ts-expect-error This is before proxying the extension, so no error.\n SAMMIExtensions[response.id]!._config ??= response;\n if (settings.skipProxying) return response;\n\n SAMMIExtensions[response.id] = new Proxy(SAMMIExtensions[response.id]!, {\n set(target, prop) {\n console.error(PROXY_PREFIX, \": Blocked setting value of:\", prop, \"on:\", target._config?.id);\n return true;\n },\n defineProperty(target, property) {\n console.error(PROXY_PREFIX, \": Blocked property redefinition of:\", property, \"on:\", target._config?.id);\n return true;\n },\n deleteProperty(target, p) {\n console.error(PROXY_PREFIX, \": Blocked deletion of:\", p, \"on:\", target._config?.id);\n return true;\n },\n setPrototypeOf(target) {\n console.error(PROXY_PREFIX, \": Blocked changing prototype of:\", target._config?.id);\n return true;\n },\n });\n return response;\n}\n\n/**\n * Retrieves an [insert_external] section by its extension id.\n *\n * ### Original documentation from https://sammi.solutions/extensions/build\n * This section appears inside the extension’s tab in Bridge, and it provides a visual interface for the extension if needed. It’s written in HTML and CSS.\n *\n * @example\n * const EXTERNAL = getExternalSection(config.id);\n * EXTERNAL.querySelector(\"button\")?.addEventListener('click', () => console.log('Hello world!'));\n *\n * @param extension_id The id of the SAMMI Next extension to retrieve its [insert_external] section.\n * @returns the div element that wraps your extension.\n */\nexport function getExternalSection(extension_id: string): HTMLDivElement {\n return document.getElementById(`${extension_id}-external`) as HTMLDivElement;\n}\n\ninterface insertCommandSectionOptions {\n /**\n * Whether to wait for `sammiclient` to exist.\n * This is enabled by default because every extension that uses `SAMMI` depends on `sammiclient`.\n * You can disable it if your [insert_command] section doesn't use neither `SAMMI` nor `sammiclient`.\n *\n * @default true\n */\n waitForSammiclient?: boolean;\n /**\n * Whether to wait for `SAMMIExtensions` to exist.\n * You must set this to `true` if you use the `SAMMIExtensions` namespace inside your [insert_command] section.\n *\n * @default false\n */\n waitForSAMMIExtensions?: boolean;\n}\nconst defaultInsertCommandSectionOptions: insertCommandSectionOptions = {\n waitForSammiclient: true,\n waitForSAMMIExtensions: false,\n}\n/**\n * Generates your [insert_command] section.\n * This should be used in the default export of your extension.\n *\n * By default, it wraps your callback to wait for `sammiclient` and `SAMMI` are initialized.\n * Its behavior can be changed in the options param.\n *\n * ### Original documentation from https://sammi.solutions/extensions/build\n * In this section, you can define Extension Commands.\n * These commands will be available to users in SAMMI Core when they install your extension.\n * You can define multiple commands in this section.\n * Refer to the SAMMI Bridge documentation for Extension Command details.\n * In this section, you can also automatically call your main extension function that should run as soon as SAMMI connects to Bridge.\n *\n * @example\n * export default insertCommandSection(() => {\n * SAMMI.extCommand(\"Extension Sample Command\", 3355443, 52).catch(e => console.error(e));\n * sammiclient.on(\"Extension Sample Command\", () => {\n * const handler = async () => {\n * await SAMMI.notification('Command Sample');\n * };\n * handler().catch((e) => console.error(e));\n * });\n * });\n * export default insertCommandSection(\n * () => console.log(\"Hello world\"),\n * { waitForSammiclient: false }\n * );\n * export default insertCommandSection(\n * () => console.log(SAMMIExtensions[\"extension-id\"]),\n * { waitForSAMMIExtensions: true }\n * );\n *\n * @param callback A callback with the logic that you will insert in your [insert_command] section.\n * @param options The initialization options.\n * @returns wrapped export default callback\n */\nexport function insertCommandSection(\n callback: () => void,\n options: insertCommandSectionOptions = {\n waitForSammiclient: true,\n waitForSAMMIExtensions: false,\n },\n): () => void {\n const settings = Object.assign(defaultInsertCommandSectionOptions, options);\n\n const wrapper = () => {\n if (!sammiclient && settings.waitForSammiclient) {\n setTimeout(wrapper, 0);\n return;\n }\n\n if (!SAMMIExtensions && settings.waitForSAMMIExtensions) {\n setTimeout(wrapper, 0);\n return;\n }\n\n callback();\n };\n\n return wrapper;\n}\n\nexport type { SAMMINextExtension } from \"./types\";\nexport type { ExtensionConfig as FullExtensionConfig } from '@shared/config-types';\nexport type { ExtensionConfig };\n"],"mappings":";;;;AAKA,MAAM,eAAe;AAYrB,MAAM,8BAAoD,EACtD,cAAc,OACjB;;;;;;;;;;;;;;;AAeD,SAAgB,cAEZ,QACA,UAAgC,EAC5B,cAAc,OACjB,EACc;CACf,IAAI,WAA4B;EAC5B,IAAI,OAAO;EACX,MAAM,OAAO;EACb,SAAS,OAAO;EAChB,MAAM,OAAO;EAChB;AAED,QAAO,kBAAkB,OAAO,mBAAmB,EAAE;AACrD,iBAAgB,SAAS,MAAM,gBAAgB,SAAS,OAAO,EAAE;AACjE,KAAI,gBAAgB,SAAS,KAAK,QAC9B,OAAM,IAAI,MAAM,6DAA6D;CAEjF,MAAM,WAAW,OAAO,OAAO,6BAA6B,QAAQ;AACpE,KAAI,CAAC,SAAS,aACV,YAAW,OAAO,OAAO,SAAS;AAGtC,iBAAgB,SAAS,IAAK,YAAY;AAC1C,KAAI,SAAS,aAAc,QAAO;AAElC,iBAAgB,SAAS,MAAM,IAAI,MAAM,gBAAgB,SAAS,KAAM;EACpE,IAAI,QAAQ,MAAM;AACd,WAAQ,MAAM,cAAc,+BAA+B,MAAM,OAAO,OAAO,SAAS,GAAG;AAC3F,UAAO;;EAEX,eAAe,QAAQ,UAAU;AAC7B,WAAQ,MAAM,cAAc,uCAAuC,UAAU,OAAO,OAAO,SAAS,GAAG;AACvG,UAAO;;EAEX,eAAe,QAAQ,GAAG;AACtB,WAAQ,MAAM,cAAc,0BAA0B,GAAG,OAAO,OAAO,SAAS,GAAG;AACnF,UAAO;;EAEX,eAAe,QAAQ;AACnB,WAAQ,MAAM,cAAc,oCAAoC,OAAO,SAAS,GAAG;AACnF,UAAO;;EAEd,CAAC;AACF,QAAO;;;;;;;;;;;;;;;AAgBX,SAAgB,mBAAmB,cAAsC;AACrE,QAAO,SAAS,eAAe,GAAG,aAAa,WAAW;;AAoB9D,MAAM,qCAAkE;CACpE,oBAAoB;CACpB,wBAAwB;CAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCD,SAAgB,qBACZ,UACA,UAAuC;CACnC,oBAAoB;CACpB,wBAAwB;CAC3B,EACS;CACV,MAAM,WAAW,OAAO,OAAO,oCAAoC,QAAQ;CAE3E,MAAM,gBAAgB;AAClB,MAAI,CAAC,eAAe,SAAS,oBAAoB;AAC7C,cAAW,SAAS,EAAE;AACtB;;AAGJ,MAAI,CAAC,mBAAmB,SAAS,wBAAwB;AACrD,cAAW,SAAS,EAAE;AACtB;;AAGJ,YAAU;;AAGd,QAAO"}
@@ -0,0 +1,105 @@
1
+ //#region src/shared/config-types.d.ts
2
+ /**
3
+ * Represents the full extension config from sammi.config.ts.
4
+ * Used by the CLI to build the extension.
5
+ */
6
+ interface ExtensionConfig {
7
+ /**
8
+ * Specify a unique id for your extension here.
9
+ * Please use alphanumeric characters, dashes, and underscores only.
10
+ */
11
+ id: string;
12
+ /**
13
+ * This section names your extension, and is visible in SAMMI Bridge and SAMMI Core.
14
+ * Please use alphanumeric characters and spaces only.
15
+ */
16
+ name: string;
17
+ /**
18
+ * This section is for descriptive text about the extension, e.g. what the extension does.
19
+ * This information is displayed to the users in SAMMI Bridge-Extensions tab when they hover
20
+ * over the extension name inside the list of installed extensions.
21
+ *
22
+ * @default ""
23
+ */
24
+ info?: string;
25
+ /**
26
+ * Specify your extension version here, using numbers and dots (e.g., 2.01).
27
+ * This is crucial for the automatic version checker in Bridge, which can notify users of updates.
28
+ *
29
+ * Note: the regex pattern used for validation is `^\d+(?:\.\d+)*(?:-.*)?$`.
30
+ * Although SAMMI Next allows beta/alpha suffixes due to its RegExp,
31
+ * please note that the official SAMMI Bridge automatic version checker ignores them.
32
+ * In other words, the users only will be notified of release updates.
33
+ */
34
+ version: string;
35
+ /**
36
+ * Specify your script.ts path here.
37
+ * In your [insert_script] section, you’re encouraged to write your own TypeScript code.
38
+ */
39
+ entry: string;
40
+ /**
41
+ * Specify your external.html path here.
42
+ * Your [insert_external] section appears inside the extension’s tab in Bridge,
43
+ * and it provides a visual interface for the extension if needed. It’s written in HTML and CSS.
44
+ *
45
+ * @default undefined
46
+ */
47
+ external?: string;
48
+ /**
49
+ * Specify your over.json path here.
50
+ * In your [insert_over] section you simply copy and paste your deck from SAMMI Core you wish to distribute with your extension.
51
+ * When users install your extension, the deck will be automatically added to their SAMMI Core.
52
+ *
53
+ * @default undefined
54
+ */
55
+ over?: string;
56
+ /** Configuration related with the extension building. */
57
+ out?: {
58
+ /**
59
+ * The path where the extension will build to.
60
+ *
61
+ * @default "dist"
62
+ */
63
+ dir?: string;
64
+ /**
65
+ * The file name of the final JavaScript file.
66
+ *
67
+ * @default "extension.js"
68
+ */
69
+ js?: string;
70
+ /**
71
+ * The file name of the final SAMMI Extension File.
72
+ *
73
+ * @default "extension.sef"
74
+ */
75
+ sef?: string;
76
+ };
77
+ }
78
+ /**
79
+ * Helper function to define a SAMMI Next extension config with type safety.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * // sammi.config.mjs
84
+ * import { defineConfig } from 'sammi-next/config';
85
+ *
86
+ * export default defineConfig({
87
+ * id: 'my-extension',
88
+ * name: 'My Extension',
89
+ * version: '1.0.0',
90
+ * entry: 'src/script.ts',
91
+ * });
92
+ * ```
93
+ */
94
+ declare function defineConfig(config: ExtensionConfig): ExtensionConfig;
95
+ /**
96
+ * Resolved extension config with defaults applied.
97
+ * Used internally by the builder.
98
+ * @internal
99
+ */
100
+ interface ResolvedExtensionConfig extends Required<Omit<ExtensionConfig, 'out'>> {
101
+ out: Required<NonNullable<ExtensionConfig['out']>>;
102
+ }
103
+ //#endregion
104
+ export { ExtensionConfig, ResolvedExtensionConfig, defineConfig };
105
+ //# sourceMappingURL=config-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-types.d.mts","names":[],"sources":["../../src/shared/config-types.ts"],"mappings":";;AAKA;;;UAAiB,eAAA;EAKb;;;;EAAA,EAAA;EAyCA;;;;EAnCA,IAAA;EAmEI;;;AAoBR;;;;EA9EI,IAAA;EA8EyB;;;;AAS7B;;;;;EA5EI,OAAA;EA6Ec;;;;EAvEd,KAAA;EAsE6C;;;;;;;EA7D7C,QAAA;EA8DyC;;;;;;;EArDzC,IAAA;;EAGA,GAAA;;;;;;IAMI,GAAA;;;;;;IAOA,EAAA;;;;;;IAOA,GAAA;EAAA;AAAA;;;;;;;;;;;;;;;;;iBAoBQ,YAAA,CAAa,MAAA,EAAQ,eAAA,GAAkB,eAAA;;;;;;UAStC,uBAAA,SAAgC,QAAA,CAAS,IAAA,CAAK,eAAA;EAC3D,GAAA,EAAK,QAAA,CAAS,WAAA,CAAY,eAAA;AAAA"}
@@ -0,0 +1,24 @@
1
+ //#region src/shared/config-types.ts
2
+ /**
3
+ * Helper function to define a SAMMI Next extension config with type safety.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * // sammi.config.mjs
8
+ * import { defineConfig } from 'sammi-next/config';
9
+ *
10
+ * export default defineConfig({
11
+ * id: 'my-extension',
12
+ * name: 'My Extension',
13
+ * version: '1.0.0',
14
+ * entry: 'src/script.ts',
15
+ * });
16
+ * ```
17
+ */
18
+ function defineConfig(config) {
19
+ return config;
20
+ }
21
+
22
+ //#endregion
23
+ export { defineConfig };
24
+ //# sourceMappingURL=config-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-types.mjs","names":[],"sources":["../../src/shared/config-types.ts"],"sourcesContent":["\n/**\n * Represents the full extension config from sammi.config.ts.\n * Used by the CLI to build the extension.\n*/\nexport interface ExtensionConfig {\n /**\n * Specify a unique id for your extension here.\n * Please use alphanumeric characters, dashes, and underscores only.\n */\n id: string;\n\n /**\n * This section names your extension, and is visible in SAMMI Bridge and SAMMI Core.\n * Please use alphanumeric characters and spaces only.\n */\n name: string;\n\n /**\n * This section is for descriptive text about the extension, e.g. what the extension does.\n * This information is displayed to the users in SAMMI Bridge-Extensions tab when they hover\n * over the extension name inside the list of installed extensions.\n *\n * @default \"\"\n */\n info?: string;\n\n /**\n * Specify your extension version here, using numbers and dots (e.g., 2.01).\n * This is crucial for the automatic version checker in Bridge, which can notify users of updates.\n *\n * Note: the regex pattern used for validation is `^\\d+(?:\\.\\d+)*(?:-.*)?$`.\n * Although SAMMI Next allows beta/alpha suffixes due to its RegExp,\n * please note that the official SAMMI Bridge automatic version checker ignores them.\n * In other words, the users only will be notified of release updates.\n */\n version: string;\n\n /**\n * Specify your script.ts path here.\n * In your [insert_script] section, you’re encouraged to write your own TypeScript code.\n */\n entry: string;\n\n /**\n * Specify your external.html path here.\n * Your [insert_external] section appears inside the extension’s tab in Bridge,\n * and it provides a visual interface for the extension if needed. It’s written in HTML and CSS.\n *\n * @default undefined\n */\n external?: string;\n\n /**\n * Specify your over.json path here.\n * In your [insert_over] section you simply copy and paste your deck from SAMMI Core you wish to distribute with your extension.\n * When users install your extension, the deck will be automatically added to their SAMMI Core.\n *\n * @default undefined\n */\n over?: string;\n\n /** Configuration related with the extension building. */\n out?: {\n /**\n * The path where the extension will build to.\n *\n * @default \"dist\"\n */\n dir?: string;\n\n /**\n * The file name of the final JavaScript file.\n *\n * @default \"extension.js\"\n */\n js?: string;\n\n /**\n * The file name of the final SAMMI Extension File.\n *\n * @default \"extension.sef\"\n */\n sef?: string;\n }\n}\n\n/**\n * Helper function to define a SAMMI Next extension config with type safety.\n *\n * @example\n * ```ts\n * // sammi.config.mjs\n * import { defineConfig } from 'sammi-next/config';\n *\n * export default defineConfig({\n * id: 'my-extension',\n * name: 'My Extension',\n * version: '1.0.0',\n * entry: 'src/script.ts',\n * });\n * ```\n */\nexport function defineConfig(config: ExtensionConfig): ExtensionConfig {\n return config;\n}\n\n/**\n * Resolved extension config with defaults applied.\n * Used internally by the builder.\n * @internal\n */\nexport interface ResolvedExtensionConfig extends Required<Omit<ExtensionConfig, 'out'>> {\n out: Required<NonNullable<ExtensionConfig['out']>>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuGA,SAAgB,aAAa,QAA0C;AACnE,QAAO"}
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "sammi-next",
3
+ "version": "1.0.0",
4
+ "author": {
5
+ "name": "Benjas333",
6
+ "url": "https://github.com/Benjas333"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Benjas333/SAMMI-Next.git",
11
+ "directory": "packages/sammi-next"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/Benjas333/SAMMI-Next/issues"
15
+ },
16
+ "homepage": "https://github.com/Benjas333/SAMMI-Next",
17
+ "main": "./dist/runtime/index.mjs",
18
+ "module": "./dist/runtime/index.mjs",
19
+ "dependencies": {
20
+ "ajv": "^8.17.1",
21
+ "cac": "^6.7.14",
22
+ "chokidar": "^5.0.0",
23
+ "jiti": "^2.6.1",
24
+ "picocolors": "^1.1.1",
25
+ "sammi-bridge-types": "sammi-bridge-types",
26
+ "tsdown": "^0.20.0-beta.4"
27
+ },
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/runtime/index.d.mts",
31
+ "import": "./dist/runtime/index.mjs"
32
+ },
33
+ "./config": {
34
+ "types": "./dist/shared/config-types.d.mts",
35
+ "import": "./dist/shared/config-types.mjs"
36
+ }
37
+ },
38
+ "bin": {
39
+ "sammi-next": "./dist/node/cli.mjs"
40
+ },
41
+ "description": "Modern builder and runtime for SAMMI Extensions",
42
+ "files": [
43
+ "dist/**/*",
44
+ ".sammi/**/*"
45
+ ],
46
+ "keywords": [
47
+ "typescript",
48
+ "sammi",
49
+ "sammi-next",
50
+ "sammi-next-builder"
51
+ ],
52
+ "license": "MIT",
53
+ "private": false,
54
+ "publishConfig": {
55
+ "access": "public"
56
+ },
57
+ "scripts": {
58
+ "build": "bun run tsdown",
59
+ "dev": "bun run tsdown --watch"
60
+ },
61
+ "type": "module",
62
+ "types": "./dist/runtime/index.d.mts",
63
+ "devDependencies": {
64
+ "@types/node": "^25.0.9"
65
+ }
66
+ }