Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
899 changes: 480 additions & 419 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
},
"scripts": {
"build": "npm run build:bin && npm run build:exports",
"build:bin": "rm -rf ./dist && rollup --config rollup.config.ts --configPlugin typescript",
"build:bin": "rm -rf ./dist && rolldown --config rolldown.config.ts",
"build:exports": "tsup",
"watch": "npm run watch:bin & npm run watch:exports",
"watch:bin": "rollup --config rollup.config.ts --configPlugin typescript --watch",
"watch:bin": "rolldown --config rolldown.config.ts --watch",
"watch:exports": "tsup --watch",
"lint": "eslint --max-warnings 0",
"lint:fix": "prettier \"./src/**/*.ts\" --write",
Expand Down Expand Up @@ -72,18 +72,14 @@
"devDependencies": {
"@elgato/eslint-config": "^0.1.0",
"@elgato/prettier-config": "^0.2.4",
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.2",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.2",

"@tsconfig/node20": "^20.1.4",
"@types/ejs": "^3.1.5",
"@types/inquirer": "^9.0.7",
"@types/lodash": "^4.17.14",
"@types/node": "^22.10.7",
"@types/semver": "^7.5.8",
"rollup": "^4.30.1",
"rolldown": "^1.0.0-rc.6",
"tslib": "^2.8.1",
"tsup": "^8.5.1",
"typescript": "^5.7.3"
Expand Down
37 changes: 37 additions & 0 deletions rolldown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { defineConfig } from "rolldown";

const isWatching = !!process.env.ROLLUP_WATCH;

const banner = `#!/usr/bin/env node

/**!
* @author Elgato
* @module elgato/streamdeck
* @license MIT
* @copyright Copyright (c) Corsair Memory Inc.
*/`;

// Ignore @elgato/schema to enable auto-update.
const external = [
"@elgato/schemas",
"@elgato/schemas/streamdeck/plugins/",
"@elgato/schemas/streamdeck/plugins/json",
];

/**
* CLI bundling.
*/
export default defineConfig({
input: "src/cli.ts",
output: {
banner,
file: "bin/streamdeck.mjs",
sourcemap: isWatching,
},
external,
platform: "node",
resolve: {
conditionNames: ["node"],
},
// minify: !isWatching,
});
60 changes: 0 additions & 60 deletions rollup.config.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ async function renderTemplate(destination: string, pluginInfo: PluginInfo): Prom
template.copy("src"),
template.copy("_.gitignore", ".gitignore"),
template.copy("package.json.ejs"),
template.copy("rollup.config.mjs.ejs"),
template.copy("rolldown.config.ts.ejs"),
template.copy("tsconfig.json.ejs"),
]);
}
Expand All @@ -245,7 +245,7 @@ async function renderTemplate(destination: string, pluginInfo: PluginInfo): Prom
* @param pluginInfo Information about the plugin.
*/
async function finalize(destination: string, pluginInfo: PluginInfo): Promise<void> {
createTemplateRenderer(destination, pluginInfo, { isPreBuild: false }).copy("rollup.config.mjs.ejs");
createTemplateRenderer(destination, pluginInfo, { isPreBuild: false }).copy("rolldown.config.ts.ejs");

await link({
path: path.join(destination, `${pluginInfo.uuid}.sdPlugin`),
Expand Down
7 changes: 5 additions & 2 deletions template/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
"name": "Attach to Plugin",
"type": "node",
"request": "attach",
"processId": "${command:PickProcess}",
"outFiles": [
"${workspaceFolder}/bin/**/*.js"
],
"resolveSourceMapLocations": [
"${workspaceFolder}/**"
]
],
"streamDeckPlugin": true,
"timeout": 30000,
"restart": true,
"preLaunchTask": "watch"
}
]
}
26 changes: 26 additions & 0 deletions template/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "watch",
"type": "process",
"command": "npm",
"args": ["run", "watch"],
"isBackground": true,
"problemMatcher": [
{
"owner": "watch",
"fileLocation": "relative",
"pattern": {
"regexp": "^$"
},
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "waiting for changes"
}
}
]
}
]
}
11 changes: 3 additions & 8 deletions template/package.json.ejs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{
"scripts": {
"build": "rollup -c",
"watch": "rollup -c -w --watch.onEnd=\"streamdeck restart <%- uuid %>\""
"build": "rolldown -c rolldown.config.ts",
"watch": "rolldown -c rolldown.config.ts -w"
},
"type": "module",
"devDependencies": {
"@elgato/cli": <%- JSON.stringify(npm.cli) %>,
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-node-resolve": "^15.2.2",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.0",
"@tsconfig/node20": "^20.1.2",
"@types/node": "~20.15.0",
"rollup": "^4.0.2",
"tslib": "^2.6.2",
"rolldown": "^1.0.0-rc.6",
"typescript": "^5.2.2"
},
"dependencies": {
Expand Down
71 changes: 71 additions & 0 deletions template/rolldown.config.ts.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { defineConfig } from "rolldown";
import { exec } from "node:child_process";
import path from "node:path";
import url from "node:url";

const isWatching = !!process.env.ROLLUP_WATCH;
const sdPlugin = "<%- uuid %>";
const sdPluginFolder = `${sdPlugin}.sdPlugin`;

const config = defineConfig({
input: "src/plugin.ts",
output: {
file: `${sdPluginFolder}/bin/plugin.js`,
sourcemap: isWatching,
sourcemapPathTransform: (relativeSourcePath, sourcemapPath) => {
return url.pathToFileURL(path.resolve(path.dirname(sourcemapPath), relativeSourcePath)).href;
},
minify: !isWatching,
},
transform: {
decorator: {
legacy: true,
},
},
platform: "node",
resolve: {
conditionNames: ["node"],
},
plugins: [
{
name: "watch-externals",
buildStart() {
this.addWatchFile(`${sdPluginFolder}/manifest.json`);
},
},
{
name: "restart-stream-deck",
buildEnd() {
if (isWatching) {
exec(`streamdeck restart ${sdPlugin}`, (error, stdout, stderr) => {
if (stdout) console.log(stdout.trim());
if (stderr) console.error(stderr.trim());
if (error) console.error('Failed to restart Stream Deck:', error.message);
});
}
},
},
{
name: "emit-module-package-file",
generateBundle() {
this.emitFile({ fileName: "package.json", source: `{ "type": "module" }`, type: "asset" });
},
},
],
});
<% if (isPreBuild) { %>
/*
* This is an intermediary fix for an upstream issue that causes the build process to hang indefinitely (particularly on macOS).
* As part of the creation of the plugin, this temporary plugin is applied during the build step, but removed as part of
* the finalizing process. If you're seeing this as part of the final output, you can safely remove it.
*/
config.plugins!.push({
closeBundle() {
process.exit(0);
},
});
/*
* End of fix.
*/
<% } %>
export default config;
64 changes: 0 additions & 64 deletions template/rollup.config.mjs.ejs

This file was deleted.

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"include": [
"src",
"rollup.config.ts"
"rolldown.config.ts"
],
"exclude": [
"bin",
Expand Down