this repo has no description

Load style.css if it exists

+77 -68
+12 -8
build.mjs
··· 205 205 } 206 206 } 207 207 208 - async function buildExt(ext, side, copyManifest, fileExt) { 208 + async function buildExt(ext, side, fileExt) { 209 209 const outdir = path.join("./dist", "core-extensions", ext); 210 210 if (!fs.existsSync(outdir)) { 211 211 fs.mkdirSync(outdir, { recursive: true }); ··· 246 246 } 247 247 }; 248 248 249 + const styleInput = `packages/core-extensions/src/${ext}/style.css`; 250 + const styleOutput = `dist/core-extensions/${ext}/style.css`; 251 + 249 252 const esbuildConfig = { 250 253 entryPoints, 251 254 outdir, ··· 265 268 }, 266 269 logLevel: "silent", 267 270 plugins: [ 268 - ...(copyManifest 271 + copyStaticFiles({ 272 + src: `./packages/core-extensions/src/${ext}/manifest.json`, 273 + dest: `./dist/core-extensions/${ext}/manifest.json` 274 + }), 275 + ...(fs.existsSync(styleInput) 269 276 ? [ 270 277 copyStaticFiles({ 271 - src: `./packages/core-extensions/src/${ext}/manifest.json`, 272 - dest: `./dist/core-extensions/${ext}/manifest.json` 278 + src: styleInput, 279 + dest: styleOutput 273 280 }) 274 281 ] 275 282 : []), ··· 298 305 299 306 const coreExtensions = fs.readdirSync("./packages/core-extensions/src"); 300 307 for (const ext of coreExtensions) { 301 - let copiedManifest = false; 302 - 303 308 for (const fileExt of ["ts", "tsx"]) { 304 309 for (const type of ["index", "node", "host"]) { 305 310 if (fs.existsSync(`./packages/core-extensions/src/${ext}/${type}.${fileExt}`)) { 306 - promises.push(buildExt(ext, type, !copiedManifest, fileExt)); 307 - copiedManifest = true; 311 + promises.push(buildExt(ext, type, fileExt)); 308 312 } 309 313 } 310 314 }
-58
packages/core-extensions/src/moonbase/index.tsx
··· 45 45 dependencies: [{ ext: "moonbase", id: "stores" }] 46 46 } 47 47 }; 48 - 49 - const bg = "#222034"; 50 - const fg = "#FFFBA6"; 51 - 52 - export const styles = [ 53 - ` 54 - .moonbase-settings > :first-child { 55 - margin-top: 0px; 56 - } 57 - 58 - textarea.moonbase-resizeable { 59 - resize: vertical 60 - } 61 - 62 - .moonbase-updates-notice { 63 - background-color: ${bg}; 64 - color: ${fg}; 65 - line-height: unset; 66 - height: 36px; 67 - } 68 - 69 - .moonbase-updates-notice button { 70 - color: ${fg}; 71 - border-color: ${fg}; 72 - } 73 - 74 - .moonbase-updates-notice_text-wrapper { 75 - display: inline-flex; 76 - align-items: center; 77 - line-height: 36px; 78 - gap: 2px; 79 - } 80 - 81 - .moonbase-update-section { 82 - background-color: ${bg}; 83 - --info-help-foreground: ${fg}; 84 - border: none !important; 85 - color: ${fg}; 86 - 87 - display: flex; 88 - flex-direction: row; 89 - justify-content: space-between; 90 - } 91 - 92 - .moonbase-update-section button { 93 - --info-help-foreground: ${fg}; 94 - color: ${fg}; 95 - background-color: transparent; 96 - border-color: ${fg}; 97 - } 98 - 99 - .moonbase-update-section-buttons { 100 - display: flex; 101 - flex-direction: row; 102 - gap: 8px; 103 - } 104 - `.trim() 105 - ];
+55
packages/core-extensions/src/moonbase/style.css
··· 1 + :root { 2 + --moonbase-bg: #222034; 3 + --moonbase-fg: #fffba6; 4 + } 5 + 6 + .moonbase-settings > :first-child { 7 + margin-top: 0px; 8 + } 9 + 10 + textarea.moonbase-resizeable { 11 + resize: vertical; 12 + } 13 + 14 + .moonbase-updates-notice { 15 + background-color: var(--moonbase-bg); 16 + color: var(--moonbase-fg); 17 + line-height: unset; 18 + height: 36px; 19 + } 20 + 21 + .moonbase-updates-notice button { 22 + color: var(--moonbase-fg); 23 + border-color: var(--moonbase-fg); 24 + } 25 + 26 + .moonbase-updates-notice_text-wrapper { 27 + display: inline-flex; 28 + align-items: center; 29 + line-height: 36px; 30 + gap: 2px; 31 + } 32 + 33 + .moonbase-update-section { 34 + background-color: var(--moonbase-bg); 35 + --info-help-foreground: var(--moonbase-fg); 36 + border: none !important; 37 + color: var(--moonbase-fg); 38 + 39 + display: flex; 40 + flex-direction: row; 41 + justify-content: space-between; 42 + } 43 + 44 + .moonbase-update-section button { 45 + --info-help-foreground: var(--moonbase-fg); 46 + color: var(--moonbase-fg); 47 + background-color: transparent; 48 + border-color: var(--moonbase-fg); 49 + } 50 + 51 + .moonbase-update-section-buttons { 52 + display: flex; 53 + flex-direction: row; 54 + gap: 8px; 55 + }
+6 -2
packages/core/src/extension.ts
··· 75 75 } 76 76 } 77 77 78 + const stylePath = moonlightFS.join(dir, "style.css"); 79 + 78 80 ret.push({ 79 81 id: manifest.id, 80 82 manifest, ··· 87 89 webPath: web != null ? webPath : undefined, 88 90 webpackModules: wpModules, 89 91 nodePath: (await moonlightFS.exists(nodePath)) ? nodePath : undefined, 90 - hostPath: (await moonlightFS.exists(hostPath)) ? hostPath : undefined 92 + hostPath: (await moonlightFS.exists(hostPath)) ? hostPath : undefined, 93 + style: (await moonlightFS.exists(stylePath)) ? await moonlightFS.readFileString(stylePath) : undefined 91 94 } 92 95 }); 93 96 } catch (e) { ··· 145 148 }, 146 149 scripts: { 147 150 web, 148 - webpackModules: wpModules 151 + webpackModules: wpModules, 152 + style: coreExtensionsFs[`${ext}/style.css`] 149 153 } 150 154 }); 151 155 seen.add(manifest.id);
+3
packages/core/src/extension/loader.ts
··· 71 71 if (exports.styles != null) { 72 72 registerStyles(exports.styles.map((style, i) => `/* ${ext.id}#${i} */ ${style}`)); 73 73 } 74 + if (ext.scripts.style != null) { 75 + registerStyles([`/* ${ext.id}#style.css */ ${ext.scripts.style}`]); 76 + } 74 77 } 75 78 } 76 79
+1
packages/types/src/extension.ts
··· 75 75 webpackModules?: Record<string, string>; 76 76 nodePath?: string; 77 77 hostPath?: string; 78 + style?: string; 78 79 }; 79 80 }; 80 81