First iteration for internationalization of the loader

This commit is contained in:
Marco Rodolfi
2023-01-13 11:03:16 +01:00
parent 2ebcc67bb5
commit e4acd4aa1f
72 changed files with 73145 additions and 676 deletions
+932 -548
View File
File diff suppressed because it is too large Load Diff
+12 -15
View File
@@ -1,30 +1,27 @@
import commonjs from '@rollup/plugin-commonjs'; import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json'; import json from '@rollup/plugin-json';
import { nodeResolve } from '@rollup/plugin-node-resolve'; import { nodeResolve } from '@rollup/plugin-node-resolve';
import externalGlobals from "rollup-plugin-external-globals";
import del from 'rollup-plugin-delete'
import replace from '@rollup/plugin-replace'; import replace from '@rollup/plugin-replace';
import typescript from '@rollup/plugin-typescript'; import typescript from '@rollup/plugin-typescript';
import { defineConfig } from 'rollup'; import { defineConfig } from 'rollup';
import del from 'rollup-plugin-delete';
import externalGlobals from 'rollup-plugin-external-globals';
const hiddenWarnings = [ const hiddenWarnings = ['THIS_IS_UNDEFINED', 'EVAL'];
"THIS_IS_UNDEFINED",
"EVAL"
];
export default defineConfig({ export default defineConfig({
input: 'src/index.tsx', input: 'src/index.tsx',
plugins: [ plugins: [
del({ targets: "../backend/static/*", force: true }), del({ targets: '../backend/static/*', force: true }),
commonjs(), commonjs(),
nodeResolve(), nodeResolve(),
externalGlobals({ externalGlobals({
react: 'SP_REACT', react: 'SP_REACT',
'react-dom': 'SP_REACTDOM', 'react-dom': 'SP_REACTDOM',
// hack to shut up react-markdown // hack to shut up react-markdown
'process': '{cwd: () => {}}', process: '{cwd: () => {}}',
'path': '{dirname: () => {}, join: () => {}, basename: () => {}, extname: () => {}}', path: '{dirname: () => {}, join: () => {}, basename: () => {}, extname: () => {}}',
'url': '{fileURLToPath: (f) => f}' url: '{fileURLToPath: (f) => f}',
}), }),
typescript(), typescript(),
json(), json(),
@@ -38,11 +35,11 @@ export default defineConfig({
dir: '../backend/static', dir: '../backend/static',
format: 'esm', format: 'esm',
chunkFileNames: (chunkInfo) => { chunkFileNames: (chunkInfo) => {
return 'chunk-[hash].js' return 'chunk-[hash].js';
} },
}, },
onwarn: function ( message, handleWarning ) { onwarn: function (message, handleWarning) {
if (hiddenWarnings.some(warning => message.code === warning)) return; if (hiddenWarnings.some((warning) => message.code === warning)) return;
handleWarning(message); handleWarning(message);
} },
}); });
+1 -1
View File
@@ -38,5 +38,5 @@ export default function SettingsPage() {
route: '/decky/settings/developer', route: '/decky/settings/developer',
}); });
return <SidebarNavigation title={t('settings_navbar') as string}showTitle pages={pages} />; return <SidebarNavigation title={t('settings_navbar') as string} showTitle pages={pages} />;
} }
@@ -19,8 +19,7 @@ export default function DeveloperSettings() {
label={t('label_valve_internal')} label={t('label_valve_internal')}
description={ description={
<span style={{ whiteSpace: 'pre-line' }}> <span style={{ whiteSpace: 'pre-line' }}>
{t('valve_internal_desc1')}{' '} {t('valve_internal_desc1')} <span style={{ color: 'red' }}>{t('valve_internal_desc2')}</span>
<span style={{ color: 'red' }}>{t('valve_internal_desc2')}</span>
</span> </span>
} }
icon={<FaSteamSymbol style={{ display: 'block' }} />} icon={<FaSteamSymbol style={{ display: 'block' }} />}
@@ -60,9 +59,7 @@ export default function DeveloperSettings() {
label={t('react_devtools_label')} label={t('react_devtools_label')}
description={ description={
<> <>
<span style={{ whiteSpace: 'pre-line' }}> <span style={{ whiteSpace: 'pre-line' }}>{t('react_devtools_desc')}</span>
{t('react_devtools_desc')}
</span>
<div ref={textRef}> <div ref={textRef}>
<TextField label={'IP'} value={reactDevtoolsIP} onChange={(e) => setReactDevtoolsIP(e?.target.value)} /> <TextField label={'IP'} value={reactDevtoolsIP} onChange={(e) => setReactDevtoolsIP(e?.target.value)} />
</div> </div>
@@ -11,11 +11,7 @@ export default function RemoteDebuggingSettings() {
return ( return (
<Field <Field
label={t('remote_cef_label')} label={t('remote_cef_label')}
description={ description={<span style={{ whiteSpace: 'pre-line' }}>{t('remote_cef_desc')}</span>}
<span style={{ whiteSpace: 'pre-line' }}>
{t('remote_cef_desc')}
</span>
}
icon={<FaBug style={{ display: 'block' }} />} icon={<FaBug style={{ display: 'block' }} />}
> >
<Toggle <Toggle
@@ -47,7 +47,7 @@ function PatchNotesModal({ versionInfo, closeModal }: { versionInfo: VerInfo | n
<MarkdownRenderer onDismiss={closeModal}>{versionInfo.all[id].body}</MarkdownRenderer> <MarkdownRenderer onDismiss={closeModal}>{versionInfo.all[id].body}</MarkdownRenderer>
</WithSuspense> </WithSuspense>
) : ( ) : (
t("no_patch_notes_desc") t('no_patch_notes_desc')
)} )}
</div> </div>
</Focusable> </Focusable>
@@ -142,7 +142,7 @@ export default function UpdaterSettings() {
bottomSeparator="none" bottomSeparator="none"
nProgress={updateProgress} nProgress={updateProgress}
indeterminate={reloading} indeterminate={reloading}
sOperationText={reloading ? t("updates_reloading") : t("updates_updating")} sOperationText={reloading ? t('updates_reloading') : t('updates_updating')}
/> />
)} )}
</Field> </Field>
@@ -26,8 +26,8 @@ export default function GeneralSettings({
<StoreSelect /> <StoreSelect />
<RemoteDebuggingSettings /> <RemoteDebuggingSettings />
<Field <Field
label={t("developer_mode_label")} label={t('developer_mode_label')}
description={<span style={{ whiteSpace: 'pre-line' }}>{t("developer_mode_desc")}</span>} description={<span style={{ whiteSpace: 'pre-line' }}>{t('developer_mode_desc')}</span>}
icon={<FaTools style={{ display: 'block' }} />} icon={<FaTools style={{ display: 'block' }} />}
> >
<Toggle <Toggle
@@ -38,12 +38,12 @@ export default function GeneralSettings({
/> />
</Field> </Field>
<Field <Field
label={t("manual_plugin_label")} label={t('manual_plugin_label')}
description={<TextField label={'URL'} value={pluginURL} onChange={(e) => setPluginURL(e?.target.value)} />} description={<TextField label={'URL'} value={pluginURL} onChange={(e) => setPluginURL(e?.target.value)} />}
icon={<FaShapes style={{ display: 'block' }} />} icon={<FaShapes style={{ display: 'block' }} />}
> >
<DialogButton disabled={pluginURL.length == 0} onClick={() => installFromURL(pluginURL)}> <DialogButton disabled={pluginURL.length == 0} onClick={() => installFromURL(pluginURL)}>
{t("manual_plugin_install_button")} {t('manual_plugin_install_button')}
</DialogButton> </DialogButton>
</Field> </Field>
</div> </div>
@@ -51,7 +51,9 @@ export default function PluginList() {
<MenuItem onSelected={() => window.DeckyPluginLoader.importPlugin(name, version)}> <MenuItem onSelected={() => window.DeckyPluginLoader.importPlugin(name, version)}>
{t('reload')} {t('reload')}
</MenuItem> </MenuItem>
<MenuItem onSelected={() => window.DeckyPluginLoader.uninstallPlugin(name)}>{t('uninstall')}</MenuItem> <MenuItem onSelected={() => window.DeckyPluginLoader.uninstallPlugin(name)}>
{t('uninstall')}
</MenuItem>
</Menu>, </Menu>,
e.currentTarget ?? window, e.currentTarget ?? window,
) )
+2 -2
View File
@@ -1,3 +1,5 @@
import 'i18n.ts';
import { import {
ReactRouter, ReactRouter,
Router, Router,
@@ -22,8 +24,6 @@ import { FaReact } from 'react-icons/fa';
import Logger from './logger'; import Logger from './logger';
import { getSetting } from './utils/settings'; import { getSetting } from './utils/settings';
import "i18n.ts";
const logger = new Logger('DeveloperMode'); const logger = new Logger('DeveloperMode');
let removeSettingsObserver: () => void = () => {}; let removeSettingsObserver: () => void = () => {};
+27 -28
View File
@@ -1,32 +1,31 @@
import i18next from "i18next"; import i18next from 'i18next';
import { initReactI18next } from "react-i18next";
import Backend from 'i18next-fs-backend'; import Backend from 'i18next-fs-backend';
import { initReactI18next } from 'react-i18next';
i18next i18next
.use(initReactI18next) .use(initReactI18next)
.use(Backend) .use(Backend)
.init({ .init({
backend: backend: {
{ // path where resources get loaded from, or a function
// path where resources get loaded from, or a function // returning a path:
// returning a path: // function(lngs, namespaces) { return customPath; }
// function(lngs, namespaces) { return customPath; } // the returned path will interpolate lng, ns if provided like giving a static path
// the returned path will interpolate lng, ns if provided like giving a static path loadPath: '/locales/{{lng}}/{{ns}}.json',
loadPath: '/locales/{{lng}}/{{ns}}.json',
// path to post missing resources
// addPath: '/locales/{{lng}}/{{ns}}.missing.json',
// if you use i18next-fs-backend as caching layer in combination with i18next-chained-backend, you can optionally set an expiration time
// an example on how to use it as cache layer can be found here: https://github.com/i18next/i18next-fs-backend/blob/master/example/caching/app.js
// expirationTime: 60 * 60 * 1000
},
fallbackLng:"en",
fallbackNS:"Common",
lng: "en",
interpolation: {
escapeValue: false,
},
});
export default i18next; // path to post missing resources
// addPath: '/locales/{{lng}}/{{ns}}.missing.json',
// if you use i18next-fs-backend as caching layer in combination with i18next-chained-backend, you can optionally set an expiration time
// an example on how to use it as cache layer can be found here: https://github.com/i18next/i18next-fs-backend/blob/master/example/caching/app.js
// expirationTime: 60 * 60 * 1000
},
fallbackLng: 'en',
fallbackNS: 'Common',
lng: 'en',
interpolation: {
escapeValue: false,
},
});
export default i18next;
+2 -1
View File
@@ -1,6 +1,7 @@
import 'i18n.ts';
import PluginLoader from './plugin-loader'; import PluginLoader from './plugin-loader';
import { DeckyUpdater } from './updater'; import { DeckyUpdater } from './updater';
import "i18n.ts";
declare global { declare global {
interface Window { interface Window {
+2 -2
View File
@@ -1,3 +1,3 @@
{ {
"update_channel_label": "Update Channel" "update_channel_label": "Update Channel"
} }
+3 -3
View File
@@ -1,4 +1,4 @@
{ {
"reload": "Reload", "reload": "Reload",
"uninstall": "Uninstall" "uninstall": "Uninstall"
} }
+6 -6
View File
@@ -1,7 +1,7 @@
{ {
"valve_internal_label": "Enable Valve Internal", "valve_internal_label": "Enable Valve Internal",
"valve_internal_desc1": "Enables the Valve internal developer menu.", "valve_internal_desc1": "Enables the Valve internal developer menu.",
"valve_internal_desc2": "Do not touch anything in this menu unless you know what it does.", "valve_internal_desc2": "Do not touch anything in this menu unless you know what it does.",
"react_devtools_label": "Enable React DevTools", "react_devtools_label": "Enable React DevTools",
"react_devtools_desc": "Enables connection to a computer running React DevTools. Changing this setting will reload Steam. Set the IP address before enabling." "react_devtools_desc": "Enables connection to a computer running React DevTools. Changing this setting will reload Steam. Set the IP address before enabling."
} }
+2 -2
View File
@@ -1,3 +1,3 @@
{ {
"select_version": "Select a version" "select_version": "Select a version"
} }
+4 -4
View File
@@ -1,5 +1,5 @@
{ {
"list_no_plugin": "No plugins installed!", "list_no_plugin": "No plugins installed!",
"list_update_to": "Update to {{name}}", "list_update_to": "Update to {{name}}",
"list_plug_actions_label": "Plugin Actions" "list_plug_actions_label": "Plugin Actions"
} }
+3 -3
View File
@@ -1,4 +1,4 @@
{ {
"remote_cef_label": "Allow Remote CEF Debugging", "remote_cef_label": "Allow Remote CEF Debugging",
"remote_cef_desc": "Allow unauthenticated access to the CEF debugger to anyone in your network" "remote_cef_desc": "Allow unauthenticated access to the CEF debugger to anyone in your network"
} }
@@ -1,6 +1,6 @@
{ {
"developer_mode_label": "Developer mode", "developer_mode_label": "Developer mode",
"developer_mode_desc": "Enables Decky's developer settings.", "developer_mode_desc": "Enables Decky's developer settings.",
"manual_plugin_label": "Manual plugin install", "manual_plugin_label": "Manual plugin install",
"manual_plugin_install_button": "Install" "manual_plugin_install_button": "Install"
} }
+5 -5
View File
@@ -1,6 +1,6 @@
{ {
"general_title": "General", "general_title": "General",
"plugins_title": "Plugins", "plugins_title": "Plugins",
"developer_title": "Developer", "developer_title": "Developer",
"navbar_settings": "Decky Settings" "navbar_settings": "Decky Settings"
} }
+3 -3
View File
@@ -1,4 +1,4 @@
{ {
"store_channel_label": "Store Channel", "store_channel_label": "Store Channel",
"custom_store_label": "Custom Store" "custom_store_label": "Custom Store"
} }
+12 -12
View File
@@ -1,14 +1,14 @@
{ {
"no_patch_notes_desc": "no patch notes for this version", "no_patch_notes_desc": "no patch notes for this version",
"decky_updates": "Decky Updates", "decky_updates": "Decky Updates",
"updates_label": "Updates",
"updates_cur_version": "Current version: {{ver}}",
"updates_lat_version": "Latest version: {{ver}}",
"updates_checking": "'Checking", "updates_label": "Updates",
"updates_check_button": "Check For Updates", "updates_cur_version": "Current version: {{ver}}",
"updates_install_button": "Install Update", "updates_lat_version": "Latest version: {{ver}}",
"updates_reloading": "Reloading",
"updates_updating": "Updating" "updates_checking": "'Checking",
} "updates_check_button": "Check For Updates",
"updates_install_button": "Install Update",
"updates_reloading": "Reloading",
"updates_updating": "Updating"
}
+12 -12
View File
@@ -1,13 +1,13 @@
{ {
"enabling":"Enabling", "enabling": "Enabling",
"disabling":"Disabling", "disabling": "Disabling",
"decky_update_available":"Update to {{tag_name}} available!", "decky_update_available": "Update to {{tag_name}} available!",
"plugin_update_one":"Updates available for 1 plugin!", "plugin_update_one": "Updates available for 1 plugin!",
"plugin_update_other":"Updates available for {{number}} plugins!", "plugin_update_other": "Updates available for {{number}} plugins!",
"plugin_uninstall":"Uninstall {{name}}?", "plugin_uninstall": "Uninstall {{name}}?",
"plugin_load_error":"Error loading plugin {{name}}", "plugin_load_error": "Error loading plugin {{name}}",
"plugin_load_error_toast": "Error loading {{name}}", "plugin_load_error_toast": "Error loading {{name}}",
"error":"Error", "error": "Error",
"plugin_error_uninstall":"Please go to {{-icon}} in the Decky menu if you need to uninstall this plugin.", "plugin_error_uninstall": "Please go to {{-icon}} in the Decky menu if you need to uninstall this plugin.",
"file_picker_cancel_text": "User canceled" "file_picker_cancel_text": "User canceled"
} }
@@ -0,0 +1,3 @@
{
"update_channel_label": "Canale di aggiornamento"
}
+4
View File
@@ -0,0 +1,4 @@
{
"reload": "Ricarica",
"uninstall": "Rimuovi"
}
@@ -0,0 +1,7 @@
{
"valve_internal_label": "Abilita Menu Sviluppatore",
"valve_internal_desc1": "Abilita il menu interno di sviluppo di Valve.",
"valve_internal_desc2": "Non toccare nulla in questo menu se non sai quello che fa.",
"react_devtools_label": "Abilita i DevTools di React",
"react_devtools_desc": "Abilita la connessione ad un computer che esegue i DevTools di React. Cambiando questa impostazione ricaricherà Steam. Imposta l'indirizzo IP prima di abilitarlo."
}
+3
View File
@@ -0,0 +1,3 @@
{
"select_version": "Seleziona una versione"
}
@@ -0,0 +1,5 @@
{
"list_no_plugin": "Nessun plugin installato!",
"list_update_to": "Aggiornamento a {{name}}",
"list_plug_actions_label": "Operazioni sui plugins"
}
@@ -0,0 +1,4 @@
{
"remote_cef_label": "Permetti il debug remoto di CEF",
"remote_cef_desc": "Permetti l'accesso non autenticato a chiunque sulla tua rete locale al debugger di CEF."
}
@@ -0,0 +1,6 @@
{
"developer_mode_label": "Modalità sviluppatore",
"developer_mode_desc": "Abilità le impostazioni di sviluppo di Decky.",
"manual_plugin_label": "Installazione manuale plugins",
"manual_plugin_install_button": "Installa"
}
@@ -0,0 +1,6 @@
{
"general_title": "Generali",
"plugins_title": "Plugins",
"developer_title": "Sviluppatore",
"navbar_settings": "Impostazioni Decky"
}
+4
View File
@@ -0,0 +1,4 @@
{
"store_channel_label": "Canale del negozio",
"custom_store_label": "Negozio custom"
}
+14
View File
@@ -0,0 +1,14 @@
{
"no_patch_notes_desc": "nessuna patch notes per questa versione",
"decky_updates": "Aggiornamenti di Decky",
"updates_label": "Aggiornamenti",
"updates_cur_version": "Versione attuale: {{ver}}",
"updates_lat_version": "Ultima versione: {{ver}}",
"updates_checking": "Controllando",
"updates_check_button": "Cerca aggiornamenti",
"updates_install_button": "Installa aggiornamento",
"updates_reloading": "Ricaricando",
"updates_updating": "Aggiornando"
}
@@ -0,0 +1,13 @@
{
"enabling": "Abilitando",
"disabling": "Disabilitando",
"decky_update_available": "Disponibile aggiornamento a {{tag_name}}!",
"plugin_update_one": "Aggiornamento disponibile per un plugin!",
"plugin_update_other": "Aggiornamento disponibile per {{number}} plugins!",
"plugin_uninstall": "Rimuovo {{name}}?",
"plugin_load_error": "Errore caricando il plugin {{name}}",
"plugin_load_error_toast": "Errore caricando {{name}}",
"error": "Errore",
"plugin_error_uninstall": "Per rimuovere questo plugin vai su {{-icon}} nel menu di Decky.",
"file_picker_cancel_text": "Annullato dall'utente"
}
+9 -7
View File
@@ -9,6 +9,7 @@ import {
staticClasses, staticClasses,
} from 'decky-frontend-lib'; } from 'decky-frontend-lib';
import { FC, lazy } from 'react'; import { FC, lazy } from 'react';
import { useTranslation } from 'react-i18next';
import { FaCog, FaExclamationCircle, FaPlug } from 'react-icons/fa'; import { FaCog, FaExclamationCircle, FaPlug } from 'react-icons/fa';
import { DeckyState, DeckyStateContextProvider, useDeckyState } from './components/DeckyState'; import { DeckyState, DeckyStateContextProvider, useDeckyState } from './components/DeckyState';
@@ -27,7 +28,6 @@ import OldTabsHook from './tabs-hook.old';
import Toaster from './toaster'; import Toaster from './toaster';
import { VerInfo, callUpdaterMethod } from './updater'; import { VerInfo, callUpdaterMethod } from './updater';
import { getSetting } from './utils/settings'; import { getSetting } from './utils/settings';
import { useTranslation } from 'react-i18next';
const StorePage = lazy(() => import('./components/store/Store')); const StorePage = lazy(() => import('./components/store/Store'));
const SettingsPage = lazy(() => import('./components/settings')); const SettingsPage = lazy(() => import('./components/settings'));
@@ -133,7 +133,7 @@ class PluginLoader extends Logger {
this.toaster.toast({ this.toaster.toast({
title: 'Decky', title: 'Decky',
//body: `Updates available for ${updates.size} plugin${updates.size > 1 ? 's' : ''}!`, //body: `Updates available for ${updates.size} plugin${updates.size > 1 ? 's' : ''}!`,
body: t('plugin_update', updates.size.toString(10), {count: updates.size}), body: t('plugin_update', updates.size.toString(10), { count: updates.size }),
onClick: () => Router.Navigate('/decky/settings/plugins'), onClick: () => Router.Navigate('/decky/settings/plugins'),
}); });
} }
@@ -251,13 +251,11 @@ class PluginLoader extends Logger {
this.error(t('plugin_load_error', name), e); this.error(t('plugin_load_error', name), e);
const TheError: FC<{}> = () => ( const TheError: FC<{}> = () => (
<> <>
{t("error")}:{' '} {t('error')}:{' '}
<pre> <pre>
<code>{e instanceof Error ? e.stack : JSON.stringify(e)}</code> <code>{e instanceof Error ? e.stack : JSON.stringify(e)}</code>
</pre> </pre>
<> <>{t('plugin_error_uninstall', <FaCog style={{ display: 'inline' }} />)}</>
{t('plugin_error_uninstall', <FaCog style={{ display: 'inline' }} />)}
</>
</> </>
); );
this.plugins.push({ this.plugins.push({
@@ -266,7 +264,11 @@ class PluginLoader extends Logger {
content: <TheError />, content: <TheError />,
icon: <FaExclamationCircle />, icon: <FaExclamationCircle />,
}); });
this.toaster.toast({ title: t('error_loading_plugin_toast', name), body: '' + e, icon: <FaExclamationCircle /> }); this.toaster.toast({
title: t('error_loading_plugin_toast', name),
body: '' + e,
icon: <FaExclamationCircle />,
});
} }
} else throw new Error(`${name} frontend_bundle not OK`); } else throw new Error(`${name} frontend_bundle not OK`);
} }
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../prettier/bin-prettier.js
+22
View File
@@ -0,0 +1,22 @@
{
"name": "decky-loader",
"lockfileVersion": 2,
"requires": true,
"packages": {
"node_modules/prettier": {
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.2.tgz",
"integrity": "sha512-BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfpw==",
"dev": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
}
}
}
+6000
View File
File diff suppressed because it is too large Load Diff
+109
View File
@@ -0,0 +1,109 @@
![Prettier Banner](https://unpkg.com/prettier-logo@1.0.3/images/prettier-banner-light.svg)
<h2 align="center">Opinionated Code Formatter</h2>
<p align="center">
<em>
JavaScript
· TypeScript
· Flow
· JSX
· JSON
</em>
<br />
<em>
CSS
· SCSS
· Less
</em>
<br />
<em>
HTML
· Vue
· Angular
</em>
<br />
<em>
GraphQL
· Markdown
· YAML
</em>
<br />
<em>
<a href="https://prettier.io/docs/en/plugins.html">
Your favorite language?
</a>
</em>
</p>
<p align="center">
<a href="https://github.com/prettier/prettier/actions?query=workflow%3AProd+branch%3Amain">
<img alt="Github Actions Build Status" src="https://img.shields.io/github/actions/workflow/status/prettier/prettier/prod-test.yml?label=Prod&style=flat-square"></a>
<a href="https://github.com/prettier/prettier/actions?query=workflow%3ADev+branch%3Amain">
<img alt="Github Actions Build Status" src="https://img.shields.io/github/actions/workflow/status/prettier/prettier/dev-test.yml?label=Dev&style=flat-square"></a>
<a href="https://github.com/prettier/prettier/actions?query=workflow%3ALint+branch%3Amain">
<img alt="Github Actions Build Status" src="https://img.shields.io/github/actions/workflow/status/prettier/prettier/lint.yml?label=Lint&style=flat-square"></a>
<a href="https://codecov.io/gh/prettier/prettier">
<img alt="Codecov Coverage Status" src="https://img.shields.io/codecov/c/github/prettier/prettier.svg?style=flat-square"></a>
<a href="https://twitter.com/acdlite/status/974390255393505280">
<img alt="Blazing Fast" src="https://img.shields.io/badge/speed-blazing%20%F0%9F%94%A5-brightgreen.svg?style=flat-square"></a>
<br/>
<a href="https://www.npmjs.com/package/prettier">
<img alt="npm version" src="https://img.shields.io/npm/v/prettier.svg?style=flat-square"></a>
<a href="https://www.npmjs.com/package/prettier">
<img alt="weekly downloads from npm" src="https://img.shields.io/npm/dw/prettier.svg?style=flat-square"></a>
<a href="#badge">
<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"></a>
<a href="https://twitter.com/PrettierCode">
<img alt="Follow Prettier on Twitter" src="https://img.shields.io/twitter/follow/prettiercode.svg?label=follow+prettier&style=flat-square"></a>
</p>
## Intro
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
### Input
<!-- prettier-ignore -->
```js
foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());
```
### Output
```js
foo(
reallyLongArg(),
omgSoManyParameters(),
IShouldRefactorThis(),
isThereSeriouslyAnotherOne()
);
```
Prettier can be run [in your editor](https://prettier.io/docs/en/editors.html) on-save, in a [pre-commit hook](https://prettier.io/docs/en/precommit.html), or in [CI environments](https://prettier.io/docs/en/cli.html#list-different) to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!
---
**[Documentation](https://prettier.io/docs/en/)**
<!-- prettier-ignore -->
[Install](https://prettier.io/docs/en/install.html) ·
[Options](https://prettier.io/docs/en/options.html) ·
[CLI](https://prettier.io/docs/en/cli.html) ·
[API](https://prettier.io/docs/en/api.html)
**[Playground](https://prettier.io/playground/)**
---
## Badge
Show the world you're using _Prettier_ → [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
```md
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
```
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md).
Generated Vendored Executable
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env node
"use strict";
var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = function(cb, mod) {
return function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
};
// node_modules/semver-compare/index.js
var require_semver_compare = __commonJS({
"node_modules/semver-compare/index.js": function(exports2, module2) {
module2.exports = function cmp(a, b) {
var pa = a.split(".");
var pb = b.split(".");
for (var i = 0; i < 3; i++) {
var na = Number(pa[i]);
var nb = Number(pb[i]);
if (na > nb)
return 1;
if (nb > na)
return -1;
if (!isNaN(na) && isNaN(nb))
return 1;
if (isNaN(na) && !isNaN(nb))
return -1;
}
return 0;
};
}
});
// node_modules/please-upgrade-node/index.js
var require_please_upgrade_node = __commonJS({
"node_modules/please-upgrade-node/index.js": function(exports2, module2) {
var semverCompare = require_semver_compare();
module2.exports = function pleaseUpgradeNode2(pkg, opts) {
var opts = opts || {};
var requiredVersion = pkg.engines.node.replace(">=", "");
var currentVersion = process.version.replace("v", "");
if (semverCompare(currentVersion, requiredVersion) === -1) {
if (opts.message) {
console.error(opts.message(requiredVersion));
} else {
console.error(
pkg.name + " requires at least version " + requiredVersion + " of Node, please upgrade"
);
}
if (opts.hasOwnProperty("exitCode")) {
process.exit(opts.exitCode);
} else {
process.exit(1);
}
}
};
}
});
// bin/prettier.js
var pleaseUpgradeNode = require_please_upgrade_node();
var packageJson = require("./package.json");
pleaseUpgradeNode(packageJson);
var cli = require("./cli.js");
module.exports = cli.run(process.argv.slice(2));
+15364
View File
File diff suppressed because it is too large Load Diff
+1473
View File
File diff suppressed because one or more lines are too long
+2
View File
File diff suppressed because one or more lines are too long
+29
View File
File diff suppressed because one or more lines are too long
+26
View File
File diff suppressed because one or more lines are too long
+35
View File
File diff suppressed because one or more lines are too long
+27
View File
File diff suppressed because one or more lines are too long
+15
View File
File diff suppressed because one or more lines are too long
+36
View File
File diff suppressed because one or more lines are too long
+76
View File
File diff suppressed because one or more lines are too long
+19
View File
File diff suppressed because one or more lines are too long
+76
View File
File diff suppressed because one or more lines are too long
+257
View File
File diff suppressed because one or more lines are too long
+150
View File
File diff suppressed because one or more lines are too long
+116
View File
File diff suppressed because one or more lines are too long
+38222
View File
File diff suppressed because one or more lines are too long
+21
View File
@@ -0,0 +1,21 @@
{
"name": "prettier",
"version": "2.8.2",
"description": "Prettier is an opinionated code formatter",
"bin": "./bin-prettier.js",
"repository": "prettier/prettier",
"funding": "https://github.com/prettier/prettier?sponsor=1",
"homepage": "https://prettier.io",
"author": "James Long",
"license": "MIT",
"main": "./index.js",
"browser": "./standalone.js",
"unpkg": "./standalone.js",
"engines": {
"node": ">=10.13.0"
},
"files": [
"*.js",
"esm/*.mjs"
]
}
+2
View File
File diff suppressed because one or more lines are too long
+29
View File
File diff suppressed because one or more lines are too long
+26
View File
File diff suppressed because one or more lines are too long
+35
View File
File diff suppressed because one or more lines are too long
+27
View File
File diff suppressed because one or more lines are too long
+15
View File
File diff suppressed because one or more lines are too long
+36
View File
File diff suppressed because one or more lines are too long
+76
View File
File diff suppressed because one or more lines are too long
+19
View File
File diff suppressed because one or more lines are too long
+76
View File
File diff suppressed because one or more lines are too long
+257
View File
File diff suppressed because one or more lines are too long
+150
View File
File diff suppressed because one or more lines are too long
+116
View File
File diff suppressed because one or more lines are too long
+8978
View File
File diff suppressed because it is too large Load Diff
+35
View File
@@ -0,0 +1,35 @@
{
"name": "decky-loader",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"devDependencies": {
"prettier": "2.8.2"
}
},
"node_modules/prettier": {
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.2.tgz",
"integrity": "sha512-BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfpw==",
"dev": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
}
},
"dependencies": {
"prettier": {
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.2.tgz",
"integrity": "sha512-BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfpw==",
"dev": true
}
}
}
+5
View File
@@ -0,0 +1,5 @@
{
"devDependencies": {
"prettier": "2.8.2"
}
}