@spicetify/kit 0.1.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.
Files changed (115) hide show
  1. package/bin/spicetify-kit.js +4 -0
  2. package/dist/build.js +335 -0
  3. package/dist/check.js +284 -0
  4. package/dist/classmap.js +187 -0
  5. package/dist/cli.js +53 -0
  6. package/dist/create.js +429 -0
  7. package/dist/dev.js +100 -0
  8. package/dist/from-theme.js +96 -0
  9. package/dist/install.js +60 -0
  10. package/dist/launch.js +122 -0
  11. package/dist/pack.js +31 -0
  12. package/dist/push.js +211 -0
  13. package/dist/vault.js +108 -0
  14. package/package.json +49 -0
  15. package/vendor/classmaps/1020096/classmap-19f856aefd5.json +109 -0
  16. package/vendor/shims/chunks.d.ts +10 -0
  17. package/vendor/shims/remote-modules.d.ts +6 -0
  18. package/vendor/shims/spicetify.d.ts +2437 -0
  19. package/vendor/stdlib/deps.ts +24 -0
  20. package/vendor/stdlib/index.ts +24 -0
  21. package/vendor/stdlib/lib/modal.tsx +128 -0
  22. package/vendor/stdlib/lib/popover.ts +84 -0
  23. package/vendor/stdlib/lib/primitives-classes.ts +66 -0
  24. package/vendor/stdlib/lib/primitives-vanilla.ts +277 -0
  25. package/vendor/stdlib/lib/primitives.tsx +314 -0
  26. package/vendor/stdlib/load.ts +17 -0
  27. package/vendor/stdlib/metadata.json +18 -0
  28. package/vendor/stdlib/mixin.ts +32 -0
  29. package/vendor/stdlib/mod.ts +26 -0
  30. package/vendor/stdlib/src/chunks.d.ts +10 -0
  31. package/vendor/stdlib/src/client.ts +114 -0
  32. package/vendor/stdlib/src/createIconComponent.tsx +29 -0
  33. package/vendor/stdlib/src/events.mix.ts +55 -0
  34. package/vendor/stdlib/src/events.ts +58 -0
  35. package/vendor/stdlib/src/expose/GraphQL.ts +40 -0
  36. package/vendor/stdlib/src/expose/Platform.ts +48 -0
  37. package/vendor/stdlib/src/expose/React.ts +95 -0
  38. package/vendor/stdlib/src/expose/ReactFlipToolkitSpring.ts +27 -0
  39. package/vendor/stdlib/src/expose/ReduxStore.ts +39 -0
  40. package/vendor/stdlib/src/expose/SettingsSection.ts +60 -0
  41. package/vendor/stdlib/src/expose/Snackbar.ts +34 -0
  42. package/vendor/stdlib/src/expose/Tippy.ts +26 -0
  43. package/vendor/stdlib/src/expose/enqueueImageSnackbar.ts +25 -0
  44. package/vendor/stdlib/src/expose/index.ts +14 -0
  45. package/vendor/stdlib/src/expose/jsx-runtime.ts +46 -0
  46. package/vendor/stdlib/src/expose/react-dom-shim.ts +50 -0
  47. package/vendor/stdlib/src/expose/react-shim.ts +116 -0
  48. package/vendor/stdlib/src/logger.ts +35 -0
  49. package/vendor/stdlib/src/playbar-compat.tsx +136 -0
  50. package/vendor/stdlib/src/registers/index.ts +176 -0
  51. package/vendor/stdlib/src/registers/menu.ts +160 -0
  52. package/vendor/stdlib/src/registers/mount.ts +307 -0
  53. package/vendor/stdlib/src/registers/nativeAnchors.ts +49 -0
  54. package/vendor/stdlib/src/registers/navlink.tsx +165 -0
  55. package/vendor/stdlib/src/registers/order.ts +22 -0
  56. package/vendor/stdlib/src/registers/panel.ts +168 -0
  57. package/vendor/stdlib/src/registers/playbarButton.tsx +93 -0
  58. package/vendor/stdlib/src/registers/playbarWidget.tsx +71 -0
  59. package/vendor/stdlib/src/registers/registry.ts +12 -0
  60. package/vendor/stdlib/src/registers/root.ts +101 -0
  61. package/vendor/stdlib/src/registers/route.ts +123 -0
  62. package/vendor/stdlib/src/registers/settingsRow.tsx +56 -0
  63. package/vendor/stdlib/src/registers/settingsSection.ts +59 -0
  64. package/vendor/stdlib/src/registers/topbarLeftButton.tsx +86 -0
  65. package/vendor/stdlib/src/registers/topbarRightButton.tsx +87 -0
  66. package/vendor/stdlib/src/storage.ts +163 -0
  67. package/vendor/stdlib/src/util.ts +62 -0
  68. package/vendor/stdlib/src/utils/index.ts +16 -0
  69. package/vendor/stdlib/src/webpack/ClassNames.gen.ts +10 -0
  70. package/vendor/stdlib/src/webpack/ClassNames.ts +6 -0
  71. package/vendor/stdlib/src/webpack/ClassNames.xpui.ts +16 -0
  72. package/vendor/stdlib/src/webpack/ComponentLibrary.gen.ts +10 -0
  73. package/vendor/stdlib/src/webpack/ComponentLibrary.ts +6 -0
  74. package/vendor/stdlib/src/webpack/ComponentLibrary.xpui.ts +18 -0
  75. package/vendor/stdlib/src/webpack/FilterContext.gen.ts +10 -0
  76. package/vendor/stdlib/src/webpack/FilterContext.ts +6 -0
  77. package/vendor/stdlib/src/webpack/FilterContext.xpui.ts +10 -0
  78. package/vendor/stdlib/src/webpack/Mousetrap.gen.ts +10 -0
  79. package/vendor/stdlib/src/webpack/Mousetrap.ts +6 -0
  80. package/vendor/stdlib/src/webpack/Mousetrap.xpui.ts +12 -0
  81. package/vendor/stdlib/src/webpack/React.gen.ts +14 -0
  82. package/vendor/stdlib/src/webpack/React.ts +6 -0
  83. package/vendor/stdlib/src/webpack/React.xpui.ts +15 -0
  84. package/vendor/stdlib/src/webpack/ReactComponents.desktop.ts +17 -0
  85. package/vendor/stdlib/src/webpack/ReactComponents.gen.ts +74 -0
  86. package/vendor/stdlib/src/webpack/ReactComponents.panel.ts +19 -0
  87. package/vendor/stdlib/src/webpack/ReactComponents.ts +50 -0
  88. package/vendor/stdlib/src/webpack/ReactComponents.xpui.ts +164 -0
  89. package/vendor/stdlib/src/webpack/ReactFlipToolkit.gen.ts +12 -0
  90. package/vendor/stdlib/src/webpack/ReactFlipToolkit.ts +6 -0
  91. package/vendor/stdlib/src/webpack/ReactFlipToolkit.xpui.ts +14 -0
  92. package/vendor/stdlib/src/webpack/ReactHooks.fullscreen.ts +15 -0
  93. package/vendor/stdlib/src/webpack/ReactHooks.gen.ts +32 -0
  94. package/vendor/stdlib/src/webpack/ReactHooks.ts +6 -0
  95. package/vendor/stdlib/src/webpack/ReactHooks.xpui.ts +38 -0
  96. package/vendor/stdlib/src/webpack/ReactQuery.gen.ts +26 -0
  97. package/vendor/stdlib/src/webpack/ReactQuery.ts +6 -0
  98. package/vendor/stdlib/src/webpack/ReactQuery.xpui.ts +46 -0
  99. package/vendor/stdlib/src/webpack/ReactRouter.gen.ts +12 -0
  100. package/vendor/stdlib/src/webpack/ReactRouter.ts +6 -0
  101. package/vendor/stdlib/src/webpack/ReactRouter.xpui.ts +22 -0
  102. package/vendor/stdlib/src/webpack/Snackbar.gen.ts +12 -0
  103. package/vendor/stdlib/src/webpack/Snackbar.ts +6 -0
  104. package/vendor/stdlib/src/webpack/Snackbar.xpui.ts +27 -0
  105. package/vendor/stdlib/src/webpack/URI.gen.ts +26 -0
  106. package/vendor/stdlib/src/webpack/URI.ts +82 -0
  107. package/vendor/stdlib/src/webpack/URI.xpui.ts +111 -0
  108. package/vendor/stdlib/src/webpack/capture-readiness.ts +49 -0
  109. package/vendor/stdlib/src/webpack/index.ts +186 -0
  110. package/vendor/stdlib/src/webpack/misc.gen.ts +16 -0
  111. package/vendor/stdlib/src/webpack/misc.ts +6 -0
  112. package/vendor/stdlib/src/webpack/misc.xpui.ts +27 -0
  113. package/vendor/stdlib/src/wpunpk.mix.ts +104 -0
  114. package/vendor/stdlib/src/wpunpk.ts +36 -0
  115. package/vendor/stdlib/vendor/rxjs.d.ts +5 -0
package/dist/vault.js ADDED
@@ -0,0 +1,108 @@
1
+ /*
2
+ * Copyright (C) 2026 Afonso Jorge Ramos
3
+ * SPDX-License-Identifier: GPL-3.0-or-later
4
+ */
5
+ /**
6
+ * vault - record a built module into a vault file for the module store.
7
+ *
8
+ * Card data (name, description, authors, tags) is embedded at the module
9
+ * level from the dist dir's own metadata.json so it cannot drift from what
10
+ * installs, alongside a per-version sha256 checksum of the artifact.
11
+ */
12
+ import { createHash } from "node:crypto";
13
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
14
+ import path from "node:path";
15
+ const USAGE = "spicetify-kit vault add <dist-dir> --artifact <url> [--zip <file>] [--vault <path>]\n (default target: vault/<id>.json, the shape a store submission takes)";
16
+ const normalizeAuthors = (authors) => authors.flatMap((a) => {
17
+ if (typeof a === "string")
18
+ return [{ name: a }];
19
+ if (a && typeof a === "object" && typeof a.name === "string") {
20
+ const { name, github } = a;
21
+ return [{ name, ...(typeof github === "string" ? { github } : {}) }];
22
+ }
23
+ return [];
24
+ });
25
+ const metadataSubset = (meta) => {
26
+ const out = {};
27
+ if (typeof meta.name === "string")
28
+ out.name = meta.name;
29
+ if (typeof meta.description === "string")
30
+ out.description = meta.description;
31
+ if (Array.isArray(meta.authors))
32
+ out.authors = normalizeAuthors(meta.authors);
33
+ if (Array.isArray(meta.tags))
34
+ out.tags = meta.tags;
35
+ if (typeof meta.preview === "string" && /^https?:\/\//.test(meta.preview))
36
+ out.preview = meta.preview;
37
+ if (typeof meta.repository === "string" && meta.repository.startsWith("https://"))
38
+ out.repository = meta.repository;
39
+ if (typeof meta.readme === "string" && meta.readme.startsWith("https://"))
40
+ out.readme = meta.readme;
41
+ if (typeof meta.license === "string" && meta.license.trim())
42
+ out.license = meta.license.trim();
43
+ return out;
44
+ };
45
+ const sha256 = (bytes) => `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
46
+ const today = () => new Date().toISOString().slice(0, 10);
47
+ async function download(url) {
48
+ const res = await fetch(url);
49
+ if (!res.ok)
50
+ throw new Error(`${url} -> HTTP ${res.status}`);
51
+ return Buffer.from(await res.arrayBuffer());
52
+ }
53
+ export async function runVault(argv, cwd = process.cwd()) {
54
+ const [cmd, ...rest] = argv;
55
+ if (cmd !== "add")
56
+ throw new Error(USAGE);
57
+ const distArg = rest.find((a) => !a.startsWith("--"));
58
+ const flag = (n) => {
59
+ const i = rest.indexOf(`--${n}`);
60
+ return i >= 0 ? rest[i + 1] : undefined;
61
+ };
62
+ const artifact = flag("artifact");
63
+ if (!distArg || !artifact)
64
+ throw new Error(USAGE);
65
+ const distDir = path.resolve(cwd, distArg);
66
+ const meta = JSON.parse(readFileSync(path.join(distDir, "metadata.json"), "utf8"));
67
+ const id = meta.name;
68
+ const version = meta.version;
69
+ if (!id || !version)
70
+ throw new Error(`${distArg}/metadata.json must set name and version`);
71
+ const zip = flag("zip");
72
+ const bytes = zip ? readFileSync(path.resolve(cwd, zip)) : await download(artifact);
73
+ const checksum = sha256(bytes);
74
+ // One file per module, which is exactly what a submission to the
75
+ // registry is: vault/<id>.json holding this module and nothing else.
76
+ const vaultPath = path.resolve(cwd, flag("vault") ?? path.join("vault", `${id}.json`));
77
+ const module = existsSync(vaultPath)
78
+ ? JSON.parse(readFileSync(vaultPath, "utf8"))
79
+ : { v: {} };
80
+ module.v ??= {};
81
+ // A published version is immutable: its checksum is what every install
82
+ // of it was verified against, so re-pointing it at different bytes is
83
+ // refused here as well as by the registry's validator.
84
+ const existing = module.v[version];
85
+ if (existing?.checksum && existing.checksum.toLowerCase() !== checksum.toLowerCase()) {
86
+ throw new Error(`${id}@${version}: checksum mismatch (vault ${existing.checksum}, artifact ${checksum}); refusing to overwrite`);
87
+ }
88
+ module.v[version] = {
89
+ artifacts: [artifact],
90
+ providers: [],
91
+ checksum,
92
+ updatedAt: today(),
93
+ };
94
+ // Card data lives at the module level (one identity per module); an
95
+ // add records the newest release, so the card follows it. Curated
96
+ // per-author github attribution usually doesn't come from the
97
+ // artifact and must survive the rewrite (artifact-declared wins).
98
+ const prev = module.metadata;
99
+ const next = metadataSubset(meta);
100
+ if (prev?.authors?.length && next.authors?.length) {
101
+ const curated = new Map(prev.authors.filter((a) => a.github).map((a) => [a.name, a.github]));
102
+ next.authors = next.authors.map((a) => !a.github && curated.has(a.name) ? { ...a, github: curated.get(a.name) } : a);
103
+ }
104
+ module.metadata = next;
105
+ mkdirSync(path.dirname(vaultPath), { recursive: true });
106
+ writeFileSync(vaultPath, `${JSON.stringify(module, null, "\t")}\n`);
107
+ console.log(`added ${id}@${version} to ${vaultPath}`);
108
+ }
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@spicetify/kit",
3
+ "version": "0.1.0",
4
+ "description": "Developer kit for spicetify v3 modules: scaffold, build, hot-push, and pack",
5
+ "license": "GPL-3.0-or-later",
6
+ "homepage": "https://github.com/spicetify/modules#readme",
7
+ "bugs": {
8
+ "url": "https://github.com/spicetify/modules/issues"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/spicetify/modules.git",
13
+ "directory": "packages/kit"
14
+ },
15
+ "type": "module",
16
+ "bin": {
17
+ "spicetify-kit": "bin/spicetify-kit.js"
18
+ },
19
+ "exports": {
20
+ ".": "./dist/cli.js",
21
+ "./create": "./dist/create.js",
22
+ "./build": "./dist/build.js",
23
+ "./dev": "./dist/dev.js",
24
+ "./pack": "./dist/pack.js",
25
+ "./from-theme": "./dist/from-theme.js",
26
+ "./check": "./dist/check.js",
27
+ "./vault": "./dist/vault.js",
28
+ "./install": "./dist/install.js"
29
+ },
30
+ "files": [
31
+ "bin",
32
+ "dist",
33
+ "vendor"
34
+ ],
35
+ "engines": {
36
+ "node": ">=22"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "dependencies": {
42
+ "rolldown": "^1.2.0",
43
+ "sass-embedded": "^1.80.0"
44
+ },
45
+ "scripts": {
46
+ "build": "../../node_modules/.bin/tsc -p tsconfig.build.json",
47
+ "test": "node --test \"test/*.test.mts\""
48
+ }
49
+ }
@@ -0,0 +1,109 @@
1
+ {
2
+ "main": {
3
+ "topbar": {
4
+ "wrapper": "NXttmW3KPwE1r4Am",
5
+ "left": {
6
+ "button": {
7
+ "wrapper": "kUHE42xvQVzWqabl",
8
+ "icon": {
9
+ "wrapper": "IYDlXmBmmUKHveMzIPCF"
10
+ }
11
+ },
12
+ "button_t": {
13
+ "wrapper": "_Bg_zSvFrEutyacG"
14
+ }
15
+ },
16
+ "right": {
17
+ "button": {
18
+ "wrapper": "kUHE42xvQVzWqabl"
19
+ },
20
+ "button_t": {
21
+ "wrapper": "sXjzYBob5Y4psogB"
22
+ },
23
+ "upgrade_button": {
24
+ "wrapper": "Upqw01TOXETOmR5Td7Dj"
25
+ }
26
+ }
27
+ },
28
+ "playbar": {
29
+ "widget": {},
30
+ "controls": {},
31
+ "buttons": {
32
+ "button": {
33
+ "wrapper": "_EuXSrqTA94N1Evn",
34
+ "wrapper__active": "v1kNYVvW5P8Wa4jS",
35
+ "wrapper__indicator": "EHxL6K_6WWDlTCZP6x5w"
36
+ }
37
+ }
38
+ },
39
+ "navbar": {
40
+ "link": {
41
+ "wrapper": "kUHE42xvQVzWqabl",
42
+ "container": "kUHE42xvQVzWqabl",
43
+ "container__active": "kUHE42xvQVzWqabl"
44
+ }
45
+ },
46
+ "global_navbar": {},
47
+ "sidebar": {},
48
+ "panel": {}
49
+ },
50
+ "tracklist": {
51
+ "column_header": "F_VvNCRKZ2cKj1a9"
52
+ },
53
+ "search_chips": {
54
+ "wrapper_wrapper": "qZHfdckfFVY5AURF",
55
+ "wrapper": "x_HLN829yDsvJDgl",
56
+ "container": "dxlv5wfAu8zgm7HY",
57
+ "chip": "U4idT8HUFwfj7PWP"
58
+ },
59
+ "modal": {
60
+ "widget_generator": {
61
+ "container": "gx9qsprOAO4ubEFc",
62
+ "header": {
63
+ "container": "g9sFYudWkUldbuNa",
64
+ "close": "Pk4GI8WfBMjS5R2J"
65
+ },
66
+ "content": {
67
+ "container": "ywtSYUL2xRwVlvSo"
68
+ }
69
+ },
70
+ "track_credits": {
71
+ "container": "p5LJBmlswjcRT458",
72
+ "header": {
73
+ "container": "idsrX6VAUY49Eczw",
74
+ "close": "_18qFNPzv7Eyyck8"
75
+ },
76
+ "content": {
77
+ "container": "yKG9lWaUWIBUyVCu"
78
+ }
79
+ }
80
+ },
81
+ "settings": {
82
+ "header": {
83
+ "container": "fEEfljGMIEhhmWVi"
84
+ },
85
+ "section": {
86
+ "container": "nWR7PbHjFXQJiYNL"
87
+ },
88
+ "button": {
89
+ "wrapper": "nHgEqWYM1q0omZ6y"
90
+ },
91
+ "text_input": "e-10451-form-input e-10451-form-control encore-text-body-medium"
92
+ },
93
+ "scrollable_text": {
94
+ "container": "MyaStf5D5Im3gt9M",
95
+ "wrapper": "dxlv5wfAu8zgm7HY"
96
+ },
97
+ "sort_box": {
98
+ "list": {
99
+ "button": "LQ6y2jhZZtMS7xCr"
100
+ }
101
+ },
102
+ "search_box": {
103
+ "container": "S0nU7XTXYMOBcASz",
104
+ "expand_button": "eu6ObgEHE5owtzi_"
105
+ },
106
+ "context_menu": {
107
+ "menu_item": "yqG4N5YYcY4uEujt"
108
+ }
109
+ }
@@ -0,0 +1,10 @@
1
+ // Ambient declaration for the chunk-promise table the modular loader
2
+ // maintains on globalThis; keyed by chunk path plus aliases like "xpui".
3
+ declare global {
4
+ var CHUNKS: Record<
5
+ string,
6
+ { promise: Promise<unknown>; resolve?: (value?: unknown) => void; reject?: (reason?: unknown) => void }
7
+ >;
8
+ }
9
+
10
+ export {};
@@ -0,0 +1,6 @@
1
+ // Remote and data-URL imports carry no local type information; stitch
2
+ // leaves the URLs untouched at build time and the editor treats them
3
+ // as any.
4
+ declare module "https://*";
5
+ declare module "npm:*";
6
+ declare module "data:*";