sammi-next 1.4.1 → 1.5.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.
- package/README.md +6 -1
- package/bin/sammi-next.mjs +3 -0
- package/dist/node/cli.mjs +324 -2
- package/dist/node/cli.mjs.map +1 -1
- package/dist/runtime/{index.d.mts → index.d.ts} +29 -3
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/{index.mjs → index.js} +3 -3
- package/dist/runtime/index.js.map +1 -0
- package/dist/shared/{config-types.d.mts → config-types.d.ts} +3 -2
- package/dist/shared/{config-types.d.mts.map → config-types.d.ts.map} +1 -1
- package/dist/shared/{config-types.mjs → config-types.js} +3 -2
- package/dist/shared/config-types.js.map +1 -0
- package/package.json +14 -10
- package/dist/build-BOiGEhdO.mjs +0 -170
- package/dist/build-BOiGEhdO.mjs.map +0 -1
- package/dist/global-BaL6-Y6j.d.mts +0 -349
- package/dist/global-BaL6-Y6j.d.mts.map +0 -1
- package/dist/node/build.d.mts +0 -20
- package/dist/node/build.d.mts.map +0 -1
- package/dist/node/build.mjs +0 -3
- package/dist/node/config.d.mts +0 -11
- package/dist/node/config.d.mts.map +0 -1
- package/dist/node/config.mjs +0 -164
- package/dist/node/config.mjs.map +0 -1
- package/dist/runtime/index.d.mts.map +0 -1
- package/dist/runtime/index.mjs.map +0 -1
- package/dist/shared/config-types.mjs.map +0 -1
package/dist/build-BOiGEhdO.mjs
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import colors from "picocolors";
|
|
4
|
-
import chokidar from "chokidar";
|
|
5
|
-
import { build } from "tsdown";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
|
|
8
|
-
//#region package.json
|
|
9
|
-
var version = "1.4.1";
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/node/constants.ts
|
|
13
|
-
const DEFAULT_CONFIG_EXTENSIONS = [
|
|
14
|
-
".mjs",
|
|
15
|
-
".js",
|
|
16
|
-
".mts",
|
|
17
|
-
".ts"
|
|
18
|
-
];
|
|
19
|
-
const GLOBAL_NAME = "SAMMIExtensions";
|
|
20
|
-
const BUILD_PREFIX = colors.blue("[sammi-next]");
|
|
21
|
-
const GREEN_CHECK = colors.green("✔");
|
|
22
|
-
const RED_X = colors.red("✗");
|
|
23
|
-
function findPackageDir() {
|
|
24
|
-
let initPath = fileURLToPath(import.meta.url);
|
|
25
|
-
while (!initPath.endsWith("sammi-next")) initPath = path.resolve(initPath, "..");
|
|
26
|
-
return initPath;
|
|
27
|
-
}
|
|
28
|
-
const SAMMI_NEXT_PACKAGE_DIR = findPackageDir();
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region src/node/utils.ts
|
|
32
|
-
function displayTime(time) {
|
|
33
|
-
if (time < 1e3) return `${time}ms`;
|
|
34
|
-
time = time / 1e3;
|
|
35
|
-
if (time < 60) return `${time.toFixed(2)}s`;
|
|
36
|
-
const mins = Math.floor(time / 60);
|
|
37
|
-
const seconds = Math.round(time % 60);
|
|
38
|
-
if (seconds === 60) return `${mins + 1}m`;
|
|
39
|
-
return `${mins}m${seconds < 1 ? "" : ` ${seconds}s`}`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/node/build.ts
|
|
44
|
-
let BuildMode = /* @__PURE__ */ function(BuildMode) {
|
|
45
|
-
BuildMode[BuildMode["DEV"] = 0] = "DEV";
|
|
46
|
-
BuildMode[BuildMode["PRODUCTION"] = 1] = "PRODUCTION";
|
|
47
|
-
return BuildMode;
|
|
48
|
-
}({});
|
|
49
|
-
const BuildModes = Object.keys(BuildMode).filter((key) => isNaN(Number(key)));
|
|
50
|
-
function readOptionalFile(path$1) {
|
|
51
|
-
if (!fs.existsSync(path$1)) return;
|
|
52
|
-
return fs.readFileSync(path$1, "utf-8");
|
|
53
|
-
}
|
|
54
|
-
const CommandRE = /\w+\(\w+,\s*{\s*default:/gm;
|
|
55
|
-
function generateSEF(options) {
|
|
56
|
-
const { config, rootDir, mode } = options;
|
|
57
|
-
const content = [];
|
|
58
|
-
const required_files = [
|
|
59
|
-
{
|
|
60
|
-
header: "extension_name",
|
|
61
|
-
content: config.name
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
header: "extension_info",
|
|
65
|
-
content: config.info
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
header: "extension_version",
|
|
69
|
-
content: config.version
|
|
70
|
-
}
|
|
71
|
-
];
|
|
72
|
-
for (const field of required_files) content.push(`[${field.header}]`, field.content, "");
|
|
73
|
-
const external = readOptionalFile(config.external);
|
|
74
|
-
content.push("[insert_external]", external ? `<div id="${config.id}-external">${external}</div>` : "", "");
|
|
75
|
-
const js_script = fs.readFileSync(path.join(rootDir, config.out.dir, config.out.js), "utf-8");
|
|
76
|
-
content.push("[insert_command]", CommandRE.test(js_script) ? `${GLOBAL_NAME}.${config.id}.default()` : "", "");
|
|
77
|
-
content.push("[insert_hook]", "", "");
|
|
78
|
-
content.push("[insert_script]", js_script, "");
|
|
79
|
-
let over = readOptionalFile(config.over);
|
|
80
|
-
if (over && mode === BuildMode.PRODUCTION) over = JSON.stringify(JSON.parse(over));
|
|
81
|
-
content.push("[insert_over]", over && over != "{}" ? over : "", "");
|
|
82
|
-
return content.join("\n");
|
|
83
|
-
}
|
|
84
|
-
function generatePreview(options) {
|
|
85
|
-
const { config } = options;
|
|
86
|
-
const external = readOptionalFile(config.external);
|
|
87
|
-
const script = fs.readFileSync(config.entry, "utf-8");
|
|
88
|
-
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);
|
|
89
|
-
}
|
|
90
|
-
async function buildOnce(options) {
|
|
91
|
-
const { config, rootDir, mode } = options;
|
|
92
|
-
const startTime = Date.now();
|
|
93
|
-
const bundle = await build({
|
|
94
|
-
entry: [config.entry],
|
|
95
|
-
outDir: path.join(rootDir, config.out.dir),
|
|
96
|
-
platform: "browser",
|
|
97
|
-
format: "iife",
|
|
98
|
-
target: ["es2022"],
|
|
99
|
-
sourcemap: false,
|
|
100
|
-
minify: mode === BuildMode.PRODUCTION,
|
|
101
|
-
banner: { js: `/* ${config.name} v${config.version} - Built with SAMMI Next v${version} */` },
|
|
102
|
-
noExternal: ["**"],
|
|
103
|
-
outputOptions: {
|
|
104
|
-
entryFileNames: config.out.js,
|
|
105
|
-
extend: true,
|
|
106
|
-
name: `${GLOBAL_NAME}.${config.id}`,
|
|
107
|
-
exports: "named"
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
const tsdownTime = Date.now();
|
|
111
|
-
console.info(GREEN_CHECK, BUILD_PREFIX, `built ${config.out.js} in ${displayTime(tsdownTime - startTime)}`);
|
|
112
|
-
fs.writeFileSync(path.join(rootDir, config.out.dir, config.out.sef), generateSEF(options), "utf-8");
|
|
113
|
-
const sefTime = Date.now();
|
|
114
|
-
console.info(GREEN_CHECK, BUILD_PREFIX, `built ${config.out.sef} in ${displayTime(sefTime - tsdownTime)}`);
|
|
115
|
-
fs.writeFileSync(path.join(rootDir, config.out.dir, "preview.html"), generatePreview(options), "utf-8");
|
|
116
|
-
const previewTime = Date.now();
|
|
117
|
-
console.info(GREEN_CHECK, BUILD_PREFIX, `built preview.html in ${displayTime(previewTime - sefTime)}`);
|
|
118
|
-
return {
|
|
119
|
-
bundle,
|
|
120
|
-
startTime
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
async function buildExtension(options) {
|
|
124
|
-
const { config, mode } = options;
|
|
125
|
-
console.info(colors.cyan(`SAMMI Next v${version} ${colors.green(`building "${config.name}" extension in ${BuildMode[mode].toLowerCase()} mode...`)}`));
|
|
126
|
-
let bundle;
|
|
127
|
-
let startTime;
|
|
128
|
-
try {
|
|
129
|
-
const res = await buildOnce(options);
|
|
130
|
-
bundle = res.bundle;
|
|
131
|
-
startTime = res.startTime;
|
|
132
|
-
if (options.mode !== BuildMode.DEV) return bundle;
|
|
133
|
-
console.info(BUILD_PREFIX, colors.cyan("watching for file changes..."));
|
|
134
|
-
const watchPaths = [
|
|
135
|
-
path.dirname(config.entry),
|
|
136
|
-
config.external,
|
|
137
|
-
config.over
|
|
138
|
-
].filter(Boolean);
|
|
139
|
-
const watcher = chokidar.watch(watchPaths, { ignoreInitial: true });
|
|
140
|
-
let timer = null;
|
|
141
|
-
watcher.on("all", (event, p) => {
|
|
142
|
-
console.info(colors.cyan(`${event}: ${p}`));
|
|
143
|
-
if (timer) clearTimeout(timer);
|
|
144
|
-
timer = setTimeout(() => {
|
|
145
|
-
buildOnce(options).then((res$1) => {
|
|
146
|
-
bundle = res$1.bundle;
|
|
147
|
-
startTime = res$1.startTime;
|
|
148
|
-
}).catch((e) => console.error(e));
|
|
149
|
-
}, 100);
|
|
150
|
-
});
|
|
151
|
-
process.on("SIGINT", () => {
|
|
152
|
-
console.info("\nStopping watch mode...");
|
|
153
|
-
watcher.close().then(() => process.exit(0)).catch((e) => {
|
|
154
|
-
console.error(e);
|
|
155
|
-
process.exit(1);
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
return watcher;
|
|
159
|
-
} catch (error) {
|
|
160
|
-
if (startTime) {
|
|
161
|
-
console.error(RED_X, BUILD_PREFIX, `Build failed in ${displayTime(Date.now() - startTime)}`);
|
|
162
|
-
startTime = void 0;
|
|
163
|
-
}
|
|
164
|
-
throw error;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
//#endregion
|
|
169
|
-
export { version as a, DEFAULT_CONFIG_EXTENSIONS as i, BuildModes as n, buildExtension as r, BuildMode as t };
|
|
170
|
-
//# sourceMappingURL=build-BOiGEhdO.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-BOiGEhdO.mjs","names":["path","VERSION","res"],"sources":["../package.json","../src/node/constants.ts","../src/node/utils.ts","../src/node/build.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\nfunction findPackageDir() {\n let initPath = fileURLToPath(import.meta.url);\n while (!initPath.endsWith('sammi-next')) {\n initPath = path.resolve(initPath, '..');\n }\n return initPath;\n}\nexport const SAMMI_NEXT_PACKAGE_DIR = findPackageDir();\n","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).filter(key => isNaN(Number(key)));\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(config.external);\n content.push(\"[insert_external]\", external ? `<div id=\"${config.id}-external\">${external}</div>` : \"\", \"\");\n\n const js_script = fs.readFileSync(path.join(rootDir, config.out.dir, config.out.js), \"utf-8\");\n content.push(\"[insert_command]\", CommandRE.test(js_script) ? `${GLOBAL_NAME}.${config.id}.default()` : \"\", \"\");\n content.push(\"[insert_hook]\", \"\", \"\") // TODO: maybe add hook retro-compatibility\n content.push(\"[insert_script]\", js_script, \"\");\n\n let over = readOptionalFile(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 } = options;\n\n const external = readOptionalFile(config.external);\n const script = fs.readFileSync(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, 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 path.dirname(config.entry),\n config.external,\n config.over,\n ].filter(Boolean);\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":";;;;;;;;;;;;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,SAAS,iBAAiB;CACtB,IAAI,WAAW,cAAc,OAAO,KAAK,IAAI;AAC7C,QAAO,CAAC,SAAS,SAAS,aAAa,CACnC,YAAW,KAAK,QAAQ,UAAU,KAAK;AAE3C,QAAO;;AAEX,MAAa,yBAAyB,gBAAgB;;;;AC1BtD,SAAgB,YAAY,MAAsB;AAC9C,KAAI,OAAO,IACP,QAAO,GAAG,KAAK;AAEnB,QAAO,OAAO;AAEd,KAAI,OAAO,GACP,QAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;CAE9B,MAAM,OAAO,KAAK,MAAM,OAAO,GAAG;CAClC,MAAM,UAAU,KAAK,MAAM,OAAO,GAAG;AAErC,KAAI,YAAY,GACZ,QAAO,GAAG,OAAO,EAAE;AAEvB,QAAO,GAAG,KAAK,GAAG,UAAU,IAAI,KAAK,IAAI,QAAQ;;;;;ACNrD,IAAY,gDAAL;AACH;AACA;;;AAGJ,MAAa,aAAa,OAAO,KAAK,UAAU,CAAC,QAAO,QAAO,MAAM,OAAO,IAAI,CAAC,CAAC;AAUlF,SAAS,iBAAiB,QAAkC;AACxD,KAAI,CAAC,GAAG,WAAWA,OAAK,CAAE;AAE1B,QAAO,GAAG,aAAaA,QAAM,QAAQ;;AAGzC,MAAM,YAAY;AAElB,SAAS,YAAY,SAAuC;CACxD,MAAM,EAA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UAC3E,GACJ,CACJ;CAED,IAAI;CACJ,IAAI;AAEJ,KAAI;EACA,MAAM,MAAM,MAAM,UAAU,QAAQ;AACpC,WAAS,IAAI;AACb,cAAY,IAAI;AAEhB,MAAI,QAAQ,SAAS,UAAU,IAAK,QAAO;AAE3C,UAAQ,KAAK,cAAc,OAAO,KAAK,+BAA+B,CAAC;EAEvE,MAAM,aAAa;GACf,KAAK,QAAQ,OAAO,MAAM;GAC1B,OAAO;GACP,OAAO;GACV,CAAC,OAAO,QAAQ;EAEjB,MAAM,UAAU,SAAS,MAAM,YAAY,EAAE,eAAe,MAAM,CAAC;EACnE,IAAI,QAA+B;AAEnC,UAAQ,GAAG,QAAQ,OAAO,MAAM;AAC5B,WAAQ,KAAK,OAAO,KAAK,GAAG,MAAM,IAAI,IAAI,CAAC;AAC3C,OAAI,MACA,cAAa,MAAM;AAEvB,WAAQ,iBAAiB;AACrB,cAAU,QAAQ,CAAC,MAAK,UAAO;AAC3B,cAASC,MAAI;AACb,iBAAYA,MAAI;MAClB,CAAC,OAAM,MAAK,QAAQ,MAAM,EAAE,CAAC;MAChC,IAAI;IACT;AAEF,UAAQ,GAAG,gBAAgB;AACvB,WAAQ,KAAK,2BAA2B;AACxC,WACK,OAAO,CACP,WAAW,QAAQ,KAAK,EAAE,CAAC,CAC3B,OAAM,MAAK;AACR,YAAQ,MAAM,EAAE;AAChB,YAAQ,KAAK,EAAE;KACjB;IACR;AACF,SAAO;UACF,OAAO;AACZ,MAAI,WAAW;AACX,WAAQ,MAAM,OAAO,cAAc,mBAAmB,YAAY,KAAK,KAAK,GAAG,UAAU,GAAG;AAC5F,eAAY;;AAEhB,QAAM"}
|
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
import EventEmitter from "node:events";
|
|
2
|
-
|
|
3
|
-
//#region ../sammi-websocket-types/dist/Socket.d.ts
|
|
4
|
-
declare class Socket extends EventEmitter<any> {
|
|
5
|
-
constructor();
|
|
6
|
-
_connected: boolean;
|
|
7
|
-
_socket: any;
|
|
8
|
-
connect(args: any): Promise<any>;
|
|
9
|
-
/**
|
|
10
|
-
* Opens a WebSocket connection to an sammi-websocket server, but does not attempt any authentication.
|
|
11
|
-
*
|
|
12
|
-
* @param {String} address url without ws:// or wss:// prefix.
|
|
13
|
-
* @param {Boolean} secure whether to us ws:// or wss://
|
|
14
|
-
* @returns {Promise}
|
|
15
|
-
* @private
|
|
16
|
-
* @return {Promise} on attempted creation of WebSocket connection.
|
|
17
|
-
*/
|
|
18
|
-
private _connect;
|
|
19
|
-
/**
|
|
20
|
-
* Authenticates to an sammi-websocket server. Must already have an active connection before calling this method.
|
|
21
|
-
*
|
|
22
|
-
* @param {String} [name=''] name of the client.
|
|
23
|
-
* @param {String} [password=''] authentication string.
|
|
24
|
-
* @private
|
|
25
|
-
* @return {Promise} on resolution of authentication call.
|
|
26
|
-
*/
|
|
27
|
-
private _authenticate;
|
|
28
|
-
/**
|
|
29
|
-
* Close and disconnect the WebSocket connection.
|
|
30
|
-
*
|
|
31
|
-
* @function
|
|
32
|
-
* @category request
|
|
33
|
-
*/
|
|
34
|
-
disconnect(): void;
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region ../sammi-websocket-types/dist/SAMMIWebSocket.d.ts
|
|
38
|
-
declare class SAMMIWebSocket extends Socket {
|
|
39
|
-
/**
|
|
40
|
-
* Generic Socket request method. Returns a promise.
|
|
41
|
-
* Generates a messageId internally and will override any passed in the args.
|
|
42
|
-
* Note that the requestType here is pre-marshaling and currently must match exactly what the websocket plugin is expecting.
|
|
43
|
-
*
|
|
44
|
-
* @param {String} requestType sammi-websocket plugin expected request type.
|
|
45
|
-
* @param {Object} [arg={}] request arguments.
|
|
46
|
-
* @return {Promise} Promise, passes the plugin response object.
|
|
47
|
-
*/
|
|
48
|
-
send(requestType: string, args?: {}): Promise<any>;
|
|
49
|
-
}
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region ../sammi-bridge-types/src/SAMMICommands.d.ts
|
|
52
|
-
/** SAMMI Core Helper Functions
|
|
53
|
-
* You can call them with SAMMI.{helperfunction}
|
|
54
|
-
* Use promises if you want to get a reply back from SAMMI
|
|
55
|
-
* No promise example: SAMMI.setVariable(myVariable, 'some value', 'someButtonID')
|
|
56
|
-
* Promise example: SAMMI.getVariable(myVariable, 'someButtonID').then(reply=>console.log(reply))
|
|
57
|
-
*/
|
|
58
|
-
declare class SAMMICommands$1 {
|
|
59
|
-
/**
|
|
60
|
-
* Get a variable from SAMMI
|
|
61
|
-
* @param {string} name - name of the variable
|
|
62
|
-
* @param {string} buttonId - button ID for local variable, default = global variable
|
|
63
|
-
*/
|
|
64
|
-
getVariable(name?: string, buttonId?: string): Promise<any>;
|
|
65
|
-
/**
|
|
66
|
-
* Set a variable in SAMMI
|
|
67
|
-
* @param {string} name - name of the variable
|
|
68
|
-
* @param {(string|number|object|array|null)} value - new value of the variable
|
|
69
|
-
* @param {string} buttonId - button ID for local variable, default = global variable
|
|
70
|
-
*/
|
|
71
|
-
setVariable(name?: string, value?: (string | number | object | any[] | null), buttonId?: string, instanceId?: number): Promise<any>;
|
|
72
|
-
/**
|
|
73
|
-
* Send a popup message to SAMMI
|
|
74
|
-
* @param {string} msg - message to send
|
|
75
|
-
*/
|
|
76
|
-
popUp(msg?: string): Promise<any>;
|
|
77
|
-
/**
|
|
78
|
-
* Send a yellow notification message to SAMMI
|
|
79
|
-
* @param {string} msg - message to send
|
|
80
|
-
*/
|
|
81
|
-
alert(msg?: string): Promise<any>;
|
|
82
|
-
/**
|
|
83
|
-
* send extension command to SAMMI
|
|
84
|
-
* @param {string} name - name of the extension command
|
|
85
|
-
* @param {string} color - box color, accepts hex/dec colors (include # for hex), default 3355443
|
|
86
|
-
* @param {string} height - height of the box in pixels, 52 for regular or 80 for resizable box, default 52
|
|
87
|
-
* @param {Object} boxes
|
|
88
|
-
* - one object per box, key = boxVariable, value = array of box params
|
|
89
|
-
* - boxVariable = variable to save the box value under
|
|
90
|
-
* - boxName = name of the box shown in the user interface
|
|
91
|
-
* - boxType = type of the box, 0 = resizable, 2 = checkbox (true/false), 14 = regular box, 15 = variable box, 18 = select box, see extension guide for more
|
|
92
|
-
* - defaultValue = default value of the variable
|
|
93
|
-
* - (optional) sizeModifier = horizontal box size, 1 is normal
|
|
94
|
-
* - (optional) [] selectOptions = array of options for the user to select (when using Select box type)
|
|
95
|
-
* @param {[boxName: string, boxType: number, defaultValue: (string | number), sizeModifier: (number|undefined), selectOptions: Array|undefined]} boxes.boxVariable
|
|
96
|
-
* */
|
|
97
|
-
extCommand(name?: string, color?: string, height?: string, boxes?: {
|
|
98
|
-
boxVariable: [boxName: string, boxType: number, defaultValue: (string | number), sizeModifier: (number | undefined), selectOptions: any[] | undefined];
|
|
99
|
-
}, triggerButton?: boolean, hidden?: boolean): Promise<any>;
|
|
100
|
-
/**
|
|
101
|
-
* Close SAMMI Bridge connection to SAMMI Core.
|
|
102
|
-
*/
|
|
103
|
-
close(): Promise<any>;
|
|
104
|
-
/**
|
|
105
|
-
* Get deck and button updates
|
|
106
|
-
* @param {boolean} enabled - enable or disable updates
|
|
107
|
-
*/
|
|
108
|
-
stayInformed(enabled: boolean): Promise<any>;
|
|
109
|
-
/**
|
|
110
|
-
* Request an array of all decks
|
|
111
|
-
* - Replies with an array ["Deck1 Name","Unique ID",crc32,"Deck2 Name","Unique ID",crc32,...]
|
|
112
|
-
* - Use crc32 value to verify deck you saved localy is the same
|
|
113
|
-
*/
|
|
114
|
-
getDeckList(): Promise<any>;
|
|
115
|
-
/**
|
|
116
|
-
* Request a deck params
|
|
117
|
-
* @param {string} id - Unique deck ID retrieved from getDeckList
|
|
118
|
-
* - Replies with an object containing a full deck
|
|
119
|
-
*/
|
|
120
|
-
getDeck(id?: string): Promise<any>;
|
|
121
|
-
/**
|
|
122
|
-
* Get deck status
|
|
123
|
-
* - Replies with either 0 (deck is disabled) or 1 (deck is enabled)
|
|
124
|
-
* @param {string} id - Unique deck ID retrieved from getDeckList
|
|
125
|
-
*/
|
|
126
|
-
getDeckStatus(deckID?: number): Promise<any>;
|
|
127
|
-
/**
|
|
128
|
-
* Change deck status
|
|
129
|
-
* @param {string} id - Unique deck ID retrieved from getDeckList
|
|
130
|
-
* @param {int} status - New deck status, 0 = disable, 1 = enable, 2 = toggle
|
|
131
|
-
*/
|
|
132
|
-
changeDeckStatus(deckID?: number, status?: int): Promise<any>;
|
|
133
|
-
/**
|
|
134
|
-
* Retrieve an image in base64
|
|
135
|
-
* @param {string} fileName - image file name without the path (image.png)
|
|
136
|
-
* - Replies with an object containing the Base64 string of the image
|
|
137
|
-
*/
|
|
138
|
-
getImage(fileName?: string): Promise<any>;
|
|
139
|
-
/**
|
|
140
|
-
* Retrieves CRC32 of a file
|
|
141
|
-
* @param {string} fileName - file name without the path (image.png)
|
|
142
|
-
*/
|
|
143
|
-
getSum(fileName?: string): Promise<any>;
|
|
144
|
-
/**
|
|
145
|
-
* Retrieves all currently active buttons
|
|
146
|
-
* - Replies with an array of button param objects
|
|
147
|
-
*/
|
|
148
|
-
getActiveButtons(): Promise<any>;
|
|
149
|
-
/**
|
|
150
|
-
* Retrieves params of all linked Twitch accounts
|
|
151
|
-
*/
|
|
152
|
-
getTwitchList(): Promise<any>;
|
|
153
|
-
/**
|
|
154
|
-
* Sends a trigger
|
|
155
|
-
* @param {number} type - type of trigger
|
|
156
|
-
* - trigger types: 0 Twitch chat, 1 Twitch Sub, 2 Twitch Gift, 3 Twitch redeem
|
|
157
|
-
* 4 Twitch Raid, 5 Twitch Bits, 6 Twitch Follower, 7 Hotkey
|
|
158
|
-
* 8 Timer, 9 OBS Trigger, 10 SAMMI Bridge, 11 twitch moderation, 12 extension trigger
|
|
159
|
-
* @param {object} data - whatever data is required for the trigger, see manual
|
|
160
|
-
*/
|
|
161
|
-
trigger(type?: number, data?: object): Promise<any>;
|
|
162
|
-
/**
|
|
163
|
-
* Sends a test trigger that will automatically include channel ID for from_channel_id pull value
|
|
164
|
-
* @param {number} type - type of trigger
|
|
165
|
-
* - trigger types: 0 Twitch chat, 1 Twitch Sub, 2 Twitch Gift, 3 Twitch redeem
|
|
166
|
-
* 4 Twitch Raid, 5 Twitch Bits, 6 Twitch Follower, 7 Hotkey
|
|
167
|
-
* 8 Timer, 9 OBS Trigger, 10 SAMMI Bridge, 11 twitch moderation, 12 extension trigger
|
|
168
|
-
* @param {object} data - whatever data is required for the trigger, see manual
|
|
169
|
-
*/
|
|
170
|
-
testTrigger(type: number, data: object): Promise<any>;
|
|
171
|
-
/**
|
|
172
|
-
* Triggers a button
|
|
173
|
-
* @param {string} id - button ID to trigger
|
|
174
|
-
*/
|
|
175
|
-
triggerButton(id?: string): Promise<any>;
|
|
176
|
-
/**
|
|
177
|
-
* Releases a button
|
|
178
|
-
* @param {string} id - button ID to release
|
|
179
|
-
*/
|
|
180
|
-
releaseButton(id?: string): Promise<any>;
|
|
181
|
-
/**
|
|
182
|
-
* Modifies a button
|
|
183
|
-
* @param {string} id - button ID to modify
|
|
184
|
-
* @param {number|undefined} color - decimal button color (BGR)
|
|
185
|
-
* @param {string|undefined} text - button text
|
|
186
|
-
* @param {string|undefined} image - button image file name
|
|
187
|
-
* @param {number|undefined} border - border size, 0-7
|
|
188
|
-
* - leave parameters empty to reset button back to default values
|
|
189
|
-
*/
|
|
190
|
-
modifyButton(id: string, color: number | undefined, text: string | undefined, image: string | undefined, border: number | undefined): Promise<any>;
|
|
191
|
-
/**
|
|
192
|
-
* Opens edit command screen in SAMMI for the selected button
|
|
193
|
-
* @param {string} deckId - deckId ID to edit
|
|
194
|
-
* @param {string} buttonId - button ID to edit
|
|
195
|
-
*/
|
|
196
|
-
editButton(deckId?: string, buttonId?: string): Promise<any>;
|
|
197
|
-
/**
|
|
198
|
-
* Retrieves all currently modified buttons
|
|
199
|
-
* - object of button objects that are currently modified
|
|
200
|
-
*/
|
|
201
|
-
getModifiedButtons(): Promise<any>;
|
|
202
|
-
/**
|
|
203
|
-
* Sends an extension trigger
|
|
204
|
-
* @param {string} trigger - name of the trigger
|
|
205
|
-
* @param {object} dats - object containing all trigger pull data
|
|
206
|
-
*/
|
|
207
|
-
triggerExt(trigger?: string, data?: {}): Promise<any>;
|
|
208
|
-
/**
|
|
209
|
-
* Deletes a variable
|
|
210
|
-
* @param {string} name - name of the variable
|
|
211
|
-
* @param {string} buttonId - button ID for local variable, default = global variable
|
|
212
|
-
*/
|
|
213
|
-
deleteVariable(name?: string, buttonId?: string): Promise<any>;
|
|
214
|
-
/**
|
|
215
|
-
* Inserts an array value
|
|
216
|
-
* @param {string} arrayName - name of the array
|
|
217
|
-
* @param {number} index - index to insert the new item at
|
|
218
|
-
* @param {string|number|object|array} value - item value
|
|
219
|
-
* @param {string} buttonId - button id, default is global
|
|
220
|
-
*/
|
|
221
|
-
insertArray(arrayName?: string, index?: number, value?: string | number | object | any[], buttonId?: string): Promise<any>;
|
|
222
|
-
/**
|
|
223
|
-
* Deletes an array value at specified index
|
|
224
|
-
* @param {string} arrayName - name of the array
|
|
225
|
-
* @param {number} index - index of the item to delete
|
|
226
|
-
* @param {string} buttonId - button id, default is global
|
|
227
|
-
*/
|
|
228
|
-
deleteArray(arrayName?: string, slot?: number, buttonId?: string): Promise<any>;
|
|
229
|
-
/**
|
|
230
|
-
* Saves a number/string into an ini file
|
|
231
|
-
* @param {string} fileName - name of the ini file
|
|
232
|
-
* @param {number} section - section name
|
|
233
|
-
* @param {string} key - key name
|
|
234
|
-
* @param {string|number} value - value to save
|
|
235
|
-
* @param {string} type - type of the value, text or number
|
|
236
|
-
*/
|
|
237
|
-
saveIni(fileName?: string, section?: number, key?: string, value?: string | number, type?: string): Promise<any>;
|
|
238
|
-
/**
|
|
239
|
-
* Loads a number/string from an ini file
|
|
240
|
-
* @param {string} fileName - name of the ini file
|
|
241
|
-
* @param {number} section - section name
|
|
242
|
-
* @param {string} key - key name
|
|
243
|
-
* @param {string} type - type of the value, text or number
|
|
244
|
-
*/
|
|
245
|
-
loadIni(fileName?: string, section?: number, key?: string, type?: string): Promise<any>;
|
|
246
|
-
/**
|
|
247
|
-
* Sends an HTTP request
|
|
248
|
-
* @param {string} url - url to send the request to
|
|
249
|
-
* @param {string} method - request method, GET, POST, PUT, DELETE
|
|
250
|
-
* @param {json} headers - stringified JSON object of headers (optional)
|
|
251
|
-
* @param {json} body - stringified request body (optional)
|
|
252
|
-
*/
|
|
253
|
-
httpRequest(url?: string, method?: string, headers?: json, body?: json): Promise<any>;
|
|
254
|
-
/**
|
|
255
|
-
* Sends a notification (tray icon bubble) message to SAMMI
|
|
256
|
-
* @param {string} msg - message to show
|
|
257
|
-
*/
|
|
258
|
-
notification(msg?: string): Promise<any>;
|
|
259
|
-
/**
|
|
260
|
-
* Opens a URL in the default browser from SAMMI
|
|
261
|
-
* @param {string} url - url to open
|
|
262
|
-
*/
|
|
263
|
-
openURL(url?: string): Promise<any>;
|
|
264
|
-
generateMessage(): string;
|
|
265
|
-
}
|
|
266
|
-
//#endregion
|
|
267
|
-
//#region ../sammi-bridge-types/src/index.d.ts
|
|
268
|
-
declare class SAMMICommands extends SAMMICommands$1 {
|
|
269
|
-
/**
|
|
270
|
-
* send extension command to SAMMI
|
|
271
|
-
* @param name - name of the extension command
|
|
272
|
-
* @param color - box color, accepts hex/dec colors (include # for hex), default 3355443
|
|
273
|
-
* @param height - height of the box in pixels, 52 for regular or 80 for resizable box, default 52
|
|
274
|
-
* @param boxes
|
|
275
|
-
* - one object per box, key = boxVariable, value = array of box params
|
|
276
|
-
* - boxVariable = variable to save the box value under
|
|
277
|
-
* - boxName = name of the box shown in the user interface
|
|
278
|
-
* - boxType = type of the box, 0 = resizable, 2 = checkbox (true/false), 14 = regular box, 15 = variable box, 18 = select box, see extension guide for more
|
|
279
|
-
* - defaultValue = default value of the variable
|
|
280
|
-
* - (optional) sizeModifier = horizontal box size, 1 is normal
|
|
281
|
-
* - (optional) [] selectOptions = array of options for the user to select (when using Select box type)
|
|
282
|
-
* @param boxes.boxVariable
|
|
283
|
-
* */
|
|
284
|
-
extCommand(name?: string, color?: string | number, height?: string | number, boxes?: {
|
|
285
|
-
[boxVariable: string]: [boxName: string, boxType: number, defaultValue: (string | number), sizeModifier: (number | undefined), selectOptions: any[] | undefined];
|
|
286
|
-
}, triggerButton?: boolean, hidden?: boolean): Promise<any>;
|
|
287
|
-
}
|
|
288
|
-
declare global {
|
|
289
|
-
/**
|
|
290
|
-
* Bridge provides native helper functions to make your life easier, without the need to use SAMMI Websocket library directly.
|
|
291
|
-
*
|
|
292
|
-
* You can call all helper functions with SAMMI.method(arguments).
|
|
293
|
-
*
|
|
294
|
-
* To use promises, you can call them with SAMMI.method(arguments).then(response=>console.log(response)).
|
|
295
|
-
*/
|
|
296
|
-
const SAMMI: SAMMICommands;
|
|
297
|
-
/**
|
|
298
|
-
* When a user triggers an extension command, SAMMI will send the data to Bridge (unless the `sendAsExtensionTrigger` parameter is set to `true`).
|
|
299
|
-
*
|
|
300
|
-
* You can listen to this data by using `sammiclient.on('extension name', (payload) => {})`.
|
|
301
|
-
*
|
|
302
|
-
* You can also use `sammiclient.addListener('extension name', functionToExecute)`.
|
|
303
|
-
*
|
|
304
|
-
* For example, let's say your extension command is called Lucky Wheel:
|
|
305
|
-
* @example
|
|
306
|
-
* sammiclient.on('Lucky Wheel', (payload) => {
|
|
307
|
-
* console.log(payload)
|
|
308
|
-
* // DO SOMETHING WITH THE EXTENSION PAYLOAD
|
|
309
|
-
* // FromButton - button ID the extension command was triggered in
|
|
310
|
-
* // instanceId - instance ID of a button the extension command was triggered in
|
|
311
|
-
* const { FromButton, instanceId } = payload.Data
|
|
312
|
-
* });
|
|
313
|
-
*/
|
|
314
|
-
const sammiclient: SAMMIWebSocket;
|
|
315
|
-
}
|
|
316
|
-
//#endregion
|
|
317
|
-
//#region src/runtime/types.d.ts
|
|
318
|
-
/**
|
|
319
|
-
* Represents useful data from the sammi.config.json. Friendly to export.
|
|
320
|
-
*/
|
|
321
|
-
interface ExtensionConfig {
|
|
322
|
-
/** This section names your extension, and is visible in SAMMI Bridge and SAMMI Core. Please use alphanumeric characters and spaces only. */
|
|
323
|
-
name: string;
|
|
324
|
-
/** Specify a unique id for your extension here. Please use alphanumeric characters, dashes, and underscores only. */
|
|
325
|
-
id: string;
|
|
326
|
-
/** 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. */
|
|
327
|
-
info?: string;
|
|
328
|
-
/** 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. */
|
|
329
|
-
version: string;
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Interface that represents most of the structures built with SAMMI Next.
|
|
333
|
-
*/
|
|
334
|
-
interface SAMMINextExtension {
|
|
335
|
-
readonly default?: () => void;
|
|
336
|
-
readonly _config?: ExtensionConfig;
|
|
337
|
-
readonly [key: string]: unknown;
|
|
338
|
-
}
|
|
339
|
-
//#endregion
|
|
340
|
-
//#region src/runtime/global.d.ts
|
|
341
|
-
declare global {
|
|
342
|
-
/**
|
|
343
|
-
* Global namespace where SAMMI Next stores all the extensions.
|
|
344
|
-
*/
|
|
345
|
-
var SAMMIExtensions: Record<string, SAMMINextExtension | undefined>;
|
|
346
|
-
}
|
|
347
|
-
//#endregion
|
|
348
|
-
export { SAMMINextExtension as n, ExtensionConfig as t };
|
|
349
|
-
//# sourceMappingURL=global-BaL6-Y6j.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-BaL6-Y6j.d.mts","names":["Socket","default","Promise","EventEmitter","constructor","_connected","_socket","connect","args","_connect","_authenticate","disconnect","SAMMIWebSocket","default","Promise","Socket","send","requestType","args","SAMMICommands","Promise","int","json","getVariable","name","buttonId","setVariable","value","instanceId","popUp","msg","alert","extCommand","color","height","boxVariable","boxName","boxType","defaultValue","sizeModifier","selectOptions","boxes","triggerButton","hidden","close","stayInformed","enabled","getDeckList","getDeck","id","getDeckStatus","deckID","changeDeckStatus","status","getImage","fileName","getSum","getActiveButtons","getTwitchList","trigger","type","data","testTrigger","releaseButton","modifyButton","text","image","border","editButton","deckId","getModifiedButtons","triggerExt","deleteVariable","insertArray","arrayName","index","deleteArray","slot","saveIni","section","key","loadIni","httpRequest","url","method","headers","body","notification","openURL","generateMessage","SAMMIWebSocket","SAMMICommands","Commands","Promise","extCommand","name","color","height","boxVariable","boxName","boxType","defaultValue","sizeModifier","selectOptions","boxes","triggerButton","hidden","_0","global","SAMMI","sammiclient","sideEffect","SAMMINextExtension","_0","Record","global","SAMMIExtensions","sideEffect"],"sources":["../../sammi-websocket-types/dist/Socket.d.ts","../../sammi-websocket-types/dist/SAMMIWebSocket.d.ts","../../sammi-bridge-types/src/SAMMICommands.d.ts","../../sammi-bridge-types/src/index.d.ts","../src/runtime/types.ts","../src/runtime/global.d.ts"],"mappings":";;;cACcA,MAAAA,SAAeG,YAAAA;EACzBC,WAAAA,CAAAA;EACAC,UAAAA;EACAC,OAAAA;EACAC,OAAAA,CAAQC,IAAAA,QAAYN,OAAAA;EAJiB;;;;;;;;;EAAA,QAc7BO,QAAAA;EAgBRE;;;;;;AC/BmB;;ED+BnBA,QAPQD,aAAAA;ECvB+B;;;;;;ED8BvCC,UAAAA,CAAAA;AAAAA;;;cC9BUC,cAAAA,SAAuBG,MAAAA;;ADDtB;;;;;;;;ECWXC,IAAAA,CAAKC,WAAAA,UAAqBC,IAAAA,QAAYJ,OAAAA;AAAAA;;;;;;ADX3B;;;cEMFK,eAAAA;EFLgBhB;;;;;EEWzBoB,WAAAA,CAAYC,IAAAA,WAAeC,QAAAA,YAAoBL,OAAAA;EFP3BlB;;;;;;EEcpBwB,WAAAA,CAAYF,IAAAA,WAAeG,KAAAA,8CAAmDF,QAAAA,WAAmBG,UAAAA,YAAsBR,OAAAA;;;ADnBpG;;ECwBnBS,KAAAA,CAAMC,GAAAA,YAAeV,OAAAA;EDvBkB;;;;EC4BvCW,KAAAA,CAAMD,GAAAA,YAAeV,OAAAA;EDlBiBN;;;;;;ACL1C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iBC,OAAAA,UAAiBC,YAAAA,qBAAiCC,YAAAA,wBAAoCC,aAAAA;EAAAA,GAChIE,aAAAA,YAAyBC,MAAAA,aAAmBb,OAAAA;AAAAA;AAAAA,QAG3Ce,MAAAA;EFvBmC;;;;;;;EAAA,ME+BjCC,KAAAA,EAAOlB,aAAAA;;;AD1BjB;;;;;;;;;;;;;;;QC6CUmB,WAAAA,EAAapB,cAAAA;AAAAA;;;;;;UC/CN,eAAA;EJHG;EIKhB,IAAA;EJLqC;EIOrC,EAAA;EJNAtF;EIQA,IAAA;EJNAE;EIQA,OAAA;AAAA;;;;UAMa,kBAAA;EAAA,SACJ,OAAA;EAAA,SACA,OAAA,GAAU,eAAA;EAAA,UACT,GAAA;AAAA;;;QCnBN6G,MAAAA;ELDMnH;;;EAAAA,IKKNoH,eAAAA,EAAiBF,MAAAA,SAAeF,kBAAAA;AAAAA"}
|
package/dist/node/build.d.mts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/node/build.mjs
DELETED
package/dist/node/config.d.mts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ExtensionConfig, ResolvedExtensionConfig } from "../shared/config-types.mjs";
|
|
2
|
-
import { 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 | undefined, command: string, build_cli: BuildCLIOptions): Promise<Required<BuildOptions>>;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { loadConfig, resolveBuildConfig, resolveExtensionConfig };
|
|
11
|
-
//# sourceMappingURL=config.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,sBACA,OAAA,UACA,SAAA,EAAW,eAAA,GAAe,OAAA,CAAA,QAAA,CAAA,YAAA"}
|