Skip to content

Commit

Permalink
feat: add support for go lang (#631)
Browse files Browse the repository at this point in the history
* update codemirror, add support for go lang

* Create perfect-zoos-grow.md
  • Loading branch information
riccardoperra authored May 4, 2024
1 parent c504ebc commit d8b472a
Show file tree
Hide file tree
Showing 17 changed files with 2,420 additions and 3,491 deletions.
13 changes: 13 additions & 0 deletions .changeset/perfect-zoos-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@codeimage/api": patch
"@codeimage/app": patch
"@codeimage/website": patch
"@codeimage/atomic-state": patch
"@codeimage/config": patch
"@codeimage/dom-export": patch
"@codeimage/highlight": patch
"@codeimage/ui": patch
"@codeimage/vanilla-extract": patch
---

feat: add support for go lang
4 changes: 2 additions & 2 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@prisma/client": "^4.15.0",
"@sinclair/typebox": "^0.28.15",
"close-with-grace": "^1.2.0",
"dotenv": "^16.1.4",
"dotenv": "^16.3.1",
"dotenv-cli": "^6.0.0",
"fastify": "^4.18.0",
"fastify-auth0-verify": "^1.2.0",
Expand All @@ -71,7 +71,7 @@
"tsup": "6.7.0",
"tsx": "3.12.7",
"typescript": "~5.3.2",
"vite": "^4.3.9",
"vite": "^4.5.1",
"vitest": "^0.31.4"
}
}
62 changes: 31 additions & 31 deletions apps/codeimage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
"cross-env": "^7.0.3",
"https-localhost": "^4.7.1",
"msw": "^0.47.4",
"prettier": "^2.8.4",
"prettier": "^2.8.7",
"rehype-raw": "7.0.0",
"rehype-slug": "6.0.0",
"rimraf": "^3.0.2",
"sass": "^1.58.3",
"sass": "^1.61.0",
"typescript": "~5.3.2",
"vite": "^3.2.5",
"vite-plugin-pwa": "^0.14.7",
"vite-plugin-solid": "^2.7.0",
"vite-tsconfig-paths": "^4.0.8",
"workbox-core": "^6.5.4",
"workbox-window": "^6.5.4"
"workbox-core": "^6.6.0",
"workbox-window": "^6.6.0"
},
"dependencies": {
"@auth0/auth0-spa-js": "^2.0.4",
Expand All @@ -50,31 +50,31 @@
"@codeimage/ui": "workspace:*",
"@codeimage/vanilla-extract": "workspace:*",
"@codemirror/autocomplete": "^6.6.1",
"@codemirror/commands": "^6.2.4",
"@codemirror/commands": "^6.5.0",
"@codemirror/lang-cpp": "^6.0.2",
"@codemirror/lang-css": "^6.2.0",
"@codemirror/lang-html": "^6.4.3",
"@codemirror/lang-css": "^6.2.1",
"@codemirror/lang-html": "^6.4.9",
"@codemirror/lang-java": "^6.0.1",
"@codemirror/lang-javascript": "^6.1.7",
"@codemirror/lang-javascript": "^6.2.2",
"@codemirror/lang-json": "^6.0.1",
"@codemirror/lang-markdown": "^6.1.1",
"@codemirror/lang-markdown": "^6.2.5",
"@codemirror/lang-php": "^6.0.1",
"@codemirror/lang-python": "^6.1.2",
"@codemirror/lang-python": "^6.1.6",
"@codemirror/lang-rust": "^6.0.1",
"@codemirror/lang-sql": "^6.4.1",
"@codemirror/language": "^6.6.0",
"@codemirror/lint": "^6.2.1",
"@codemirror/search": "^6.4.0",
"@codemirror/state": "^6.2.0",
"@codemirror/view": "^6.11.0",
"@codemirror/lang-sql": "^6.6.3",
"@codemirror/language": "^6.10.1",
"@codemirror/lint": "^6.7.0",
"@codemirror/search": "^6.5.6",
"@codemirror/state": "^6.4.1",
"@codemirror/view": "^6.26.3",
"@codeui/kit": "^0.0.37",
"@floating-ui/core": "^1.2.2",
"@floating-ui/dom": "^1.2.3",
"@floating-ui/core": "^1.5.0",
"@floating-ui/dom": "^1.5.3",
"@formatjs/intl-relativetimeformat": "11.1.4",
"@kobalte/core": "^0.11.0",
"@kobalte/core": "^0.11.2",
"@kobalte/utils": "^0.9.0",
"@kobalte/vanilla-extract": "^0.4.0",
"@lezer/highlight": "^1.1.3",
"@lezer/highlight": "^1.1.4",
"@motionone/solid": "^10.16.2",
"@ngneat/falso": "^6.4.0",
"@solid-aria/button": "^0.1.3",
Expand All @@ -84,36 +84,36 @@
"@solid-primitives/context": "^0.1.4",
"@solid-primitives/event-bus": "1.0.5",
"@solid-primitives/event-listener": "2.2.13",
"@solid-primitives/i18n": "^1.2.1",
"@solid-primitives/immutable": "^0.1.8",
"@solid-primitives/i18n": "^1.2.4",
"@solid-primitives/immutable": "^0.1.10",
"@solid-primitives/platform": "^0.0.101",
"@solid-primitives/props": "^2.2.2",
"@solid-primitives/resize-observer": "^2.0.11",
"@solid-primitives/utils": "^6.0.0",
"@solid-primitives/resize-observer": "^2.0.15",
"@solid-primitives/utils": "^6.2.1",
"@solidjs/router": "^0.8.2",
"@thisbeyond/solid-dnd": "0.7.2",
"@vanilla-extract/css": "^1.9.5",
"@vanilla-extract/css": "^1.11.0",
"@vanilla-extract/dynamic": "^2.0.3",
"@vanilla-extract/recipes": "^0.3.0",
"@vanilla-extract/sprinkles": "^1.5.1",
"@vanilla-extract/sprinkles": "^1.5.2",
"clsx": "^1.2.1",
"downloadjs": "^1.4.7",
"idb-keyval": "^6.2.0",
"inter-ui": "^3.19.3",
"modern-normalize": "^1.1.0",
"motion": "^10.15.5",
"polished": "^4.2.2",
"rxjs": "^7.8.0",
"rxjs": "^7.8.1",
"solid-codemirror": "^2.3.0",
"solid-headless": "^0.13.0",
"solid-headless": "^0.13.1",
"solid-js": "^1.8.6",
"solid-mdx": "0.0.7",
"solid-use": "^0.7.2",
"statebuilder": "^0.4.2",
"tinykeys": "^1.4.0",
"workbox-precaching": "^6.5.4",
"workbox-routing": "^6.5.4",
"workbox-strategies": "^6.5.4"
"workbox-precaching": "^6.6.0",
"workbox-routing": "^6.6.0",
"workbox-strategies": "^6.6.0"
},
"msw": {
"workerDirectory": "public"
Expand Down
25 changes: 22 additions & 3 deletions apps/codeimage/src/components/CustomEditor/CustomEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@ export default function CustomEditor(props: VoidProps<CustomEditorProps>) {
);

const [currentExtraLanguage] = createResource(icon, iconDef => {
return iconDef?.extraLanguage?.() ?? [];
return iconDef?.extraLanguage
?.extension()
.then(extension => {
return {
extension,
overrideParent: iconDef.extraLanguage?.overrideParent,
};
})
.catch(() => null);
});

const themeConfiguration = createMemo(
Expand Down Expand Up @@ -170,8 +178,19 @@ export default function CustomEditor(props: VoidProps<CustomEditorProps>) {
}),
);
createExtension(() => customFontExtension());
createExtension(currentLanguage);
createExtension(currentExtraLanguage);
createExtension(() => {
const language = currentLanguage();
const extraLanguage = currentExtraLanguage();
if (!extraLanguage && !language) {
return [];
}
if (!extraLanguage) {
return language ?? [];
}
if (extraLanguage.overrideParent) {
return extraLanguage.extension ?? [];
}
});

const lineNumberStart = createMemo(() => editor()?.lineNumberStart);
createExtension(() => {
Expand Down
63 changes: 34 additions & 29 deletions apps/codeimage/src/components/PropertyEditor/EditorStyleForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,35 +161,40 @@ export const EditorStyleForm: ParentComponent = () => {
</TwoColumnPanelRow>
</PanelRow>

<Show when={formatter.availableFormatters().length > 0}>
<PanelRow
for={'editorLanguageFormatterField'}
label={t('frame.formatter')}
>
<TwoColumnPanelRow>
<SuspenseEditorItem
fallback={<SkeletonLine width={'100%'} height={'26px'} />}
>
<Select
{...languageFormatterOptions.props()}
{...languageFormatterOptions.controlled(
() =>
editor()?.formatter ??
formatter.availableFormatters()[0].parser,
formatter => {
formatter = formatter as string;
setFormatterName(formatter);
},
)}
disabled={formatter.availableFormatters().length === 1}
options={languageFormatterOptions.options()}
aria-label={'Editor language formatter'}
id={'editorLanguageFormatterField'}
size={'xs'}
/>
</SuspenseEditorItem>
</TwoColumnPanelRow>
</PanelRow>
<Show
when={formatter.availableFormatters().length > 0}
keyed={true}
>
{_ => (
<PanelRow
for={'editorLanguageFormatterField'}
label={t('frame.formatter')}
>
<TwoColumnPanelRow>
<SuspenseEditorItem
fallback={<SkeletonLine width={'100%'} height={'26px'} />}
>
<Select
{...languageFormatterOptions.props()}
{...languageFormatterOptions.controlled(
() =>
editor()?.formatter ??
formatter.availableFormatters()[0]?.parser,
formatter => {
formatter = formatter as string;
setFormatterName(formatter);
},
)}
disabled={formatter.availableFormatters().length === 1}
options={languageFormatterOptions.options()}
aria-label={'Editor language formatter'}
id={'editorLanguageFormatterField'}
size={'xs'}
/>
</SuspenseEditorItem>
</TwoColumnPanelRow>
</PanelRow>
)}
</Show>

<PanelRow
Expand Down
2 changes: 1 addition & 1 deletion apps/codeimage/src/state/editor/activeEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const $activeEditorState = () => {
);
}
}
const defaultFormatter = formatter.availableFormatters()[0].parser;
const defaultFormatter = formatter.availableFormatters()[0]?.parser;
setEditors(currentEditorIndex(), 'formatter', defaultFormatter ?? null);
}
};
Expand Down
16 changes: 8 additions & 8 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"rollup": "^2.79.1",
"solid-start-node": "^0.2.26",
"typescript": "~5.3.2",
"vite": "^3.1.8"
"vite": "^3.2.5"
},
"sideEffects": true,
"dependencies": {
Expand All @@ -26,24 +26,24 @@
"@codemirror/language": "^6.6.0",
"@codemirror/state": "^6.2.0",
"@codemirror/view": "^6.11.0",
"@lezer/highlight": "^1.1.3",
"@lezer/highlight": "^1.1.4",
"@lhci/cli": "0.10.0",
"@motionone/solid": "^10.15.5",
"@motionone/solid": "^10.16.2",
"@solid-primitives/media": "2.0.4",
"@solid-primitives/platform": "^0.0.101",
"@solidjs/meta": "^0.28.4",
"@solidjs/router": "^0.8.2",
"@vanilla-extract/css": "^1.9.5",
"@vanilla-extract/css": "^1.11.0",
"@vanilla-extract/dynamic": "^2.0.3",
"@vanilla-extract/recipes": "^0.3.0",
"@vanilla-extract/sprinkles": "^1.5.1",
"@vanilla-extract/sprinkles": "^1.5.2",
"motion": "^10.15.5",
"purgecss": "^5.0.0",
"solid-codemirror": "^2.2.3",
"solid-js": "^1.7.3",
"solid-codemirror": "^2.3.0",
"solid-js": "^1.8.6",
"solid-start": "^0.2.26",
"solid-start-static": "^0.2.26",
"undici": "^5.11.0"
"undici": "^5.21.1"
},
"engines": {
"node": ">=16"
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,33 +61,33 @@
"devDependencies": {
"@changesets/assemble-release-plan": "^5.2.3",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.0",
"@changesets/cli": "^2.26.1",
"@changesets/config": "^2.3.0",
"@changesets/pre": "^1.0.14",
"@changesets/read": "^0.5.9",
"@commitlint/cli": "17.1.2",
"@commitlint/config-angular": "17.1.0",
"@commitlint/config-conventional": "^17.4.4",
"@types/node": "^18.14.6",
"@railway/cli": "^3.3.1",
"@types/node": "^18.16.17",
"@types/prettier": "^2.7.2",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"chalk": "5.1.2",
"cross-env": "^7.0.3",
"enquirer": "2.3.6",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.6.0",
"eslint": "^8.38.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-solid": "^0.7.4",
"husky": "8.0.1",
"lint-staged": "^13.1.2",
"lint-staged": "^13.2.1",
"pnpm-bundle-workspace-package": "^1.0.2",
"prettier": "^2.8.4",
"tslib": "^2.5.0",
"tsx": "^3.12.3",
"prettier": "^2.8.7",
"tslib": "^2.6.2",
"tsx": "^3.12.7",
"typescript": "~5.3.2",
"vite": "^3.2.5",
"@railway/cli": "^3.3.1"
"vite": "^3.2.5"
},
"engines": {
"pnpm": ">=7"
Expand Down
6 changes: 3 additions & 3 deletions packages/atomic-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
"solid-js": "^1.8.6"
},
"devDependencies": {
"@types/node": "^18.14.6",
"@types/node": "^18.16.17",
"rollup": "^2.79.1",
"rollup-preset-solid": "^1.4.0",
"rxjs": "^7.8.0",
"rxjs": "^7.8.1",
"solid-js": "^1.8.6",
"vite": "^3.2.5",
"vite-plugin-dts": "^1.7.3",
"vite-plugin-solid": "^2.6.1",
"vite-plugin-solid": "^2.7.0",
"vitest": "0.26.2"
},
"dependencies": {
Expand Down
Loading

0 comments on commit d8b472a

Please sign in to comment.