Skip to content

Commit

Permalink
feat: browser memory inspection & deps updates (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az authored Mar 26, 2024
1 parent f452226 commit 2a46074
Show file tree
Hide file tree
Showing 27 changed files with 292 additions and 180 deletions.
7 changes: 6 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* text=auto

/test/fixtures/**/* text eol=lf
/test/results/** linguist-generated
/test/fixtures/** linguist-generated text eol=lf

*.lockb binary diff=lockb
biome.json linguist-language=JSON-with-Comments
.vscode/*.json linguist-language=JSON-with-Comments
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
bun-version: 'latest'

- name: 'Setup Biome'
uses: biomejs/setup-biome@v1
uses: biomejs/setup-biome@v2
with:
version: 'latest'

Expand Down
6 changes: 3 additions & 3 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"recommendations": [
//
"biomejs.biome",
"orta.vscode-twoslash-queries",
"bradlc.vscode-tailwindcss"
"bradlc.vscode-tailwindcss",
"tobermory.es6-string-html",
"orta.vscode-twoslash-queries"
],
"unwantedRecommendations": [
// we use biome for linting and formatting
Expand Down
14 changes: 9 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.inlayHints.parameterNames.enabled": "all",
"typescript.preferences.preferTypeOnlyAutoImports": true,
"files.associations": {
// tells vscode that the file can take comments
"*.css": "tailwindcss",
"biome.json": "jsonc"
},
"editor.quickSuggestions": {
"strings": "on"
},
"tailwindCSS.includeLanguages": {
"plaintext": "html"
},
"biome.enabled": true,
// "biome.rename": true,
// "biome.searchInPath": true,
// format & lint settings
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
Expand All @@ -29,6 +27,12 @@
"[javascriptreact]": { "editor.defaultFormatter": "biomejs.biome" },
"[json]": { "editor.defaultFormatter": "biomejs.biome" },
"[jsonc]": { "editor.defaultFormatter": "biomejs.biome" },
"[astro]": { "editor.defaultFormatter": "biomejs.biome" },
"[svelte]": { "editor.defaultFormatter": "biomejs.biome" },
"files.associations": {
"biome.json": "jsonc",
"*.css": "tailwindcss"
},
"search.exclude": {
"_": true,
"**/dist": true,
Expand Down
133 changes: 109 additions & 24 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,96 @@
"vcs": {
"root": ".",
"enabled": true,
"clientKind": "git"
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"include": [
"./**/*.ts",
"./**/*.js",
"./**/*.cjs",
"./**/*.mjs",
"./**/*.jsx",
"./**/*.tsx",
"./**/*.d.ts",
"./**/*.json",
"./**/*.jsonc"
"*.ts",
"*.js",
"*.cjs",
"*.mjs",
"*.jsx",
"*.tsx",
"*.d.ts",
"*.json",
"*.jsonc",
"*.astro",
"*.svelte"
],
"ignore": ["node_modules", "dist", "_"],
"ignoreUnknown": true
},
"organizeImports": {
"enabled": false
},
"css": {
"formatter": {
"enabled": true,
"indentWidth": 2,
"lineWidth": 100,
"quoteStyle": "double",
"indentStyle": "space"
},
"parser": {
"allowWrongLineComments": true
}
},
"formatter": {
"enabled": true,
"lineWidth": 100,
"indentWidth": 2,
"indentStyle": "space",
"formatWithErrors": true,
"include": [
"./**/*.ts",
"./**/*.js",
"./**/*.cjs",
"./**/*.mjs",
"./**/*.jsx",
"./**/*.tsx",
"./**/*.d.ts",
"./**/*.json",
"./**/*.jsonc"
"*.ts",
"*.js",
"*.cjs",
"*.mjs",
"*.jsx",
"*.tsx",
"*.d.ts",
"*.json",
"*.jsonc",
"*.astro",
"*.svelte"
]
},
"linter": {
"include": [
"*.ts",
"*.js",
"*.cjs",
"*.mjs",
"*.jsx",
"*.tsx",
"*.d.ts",
"*.json",
"*.jsonc",
"*.astro",
"*.svelte"
],
"enabled": true,
"rules": {
"all": true,
"style": {
"noDefaultExport": "off",
"useFragmentSyntax": "off",
"useBlockStatements": "off",
"useNamingConvention": "off",
"useShorthandArrayType": "off",
"useSelfClosingElements": "off",
"noUnusedTemplateLiteral": "off"
"noUnusedTemplateLiteral": "off",
"useConsistentArrayType": { "level": "warn", "options": { "syntax": "generic" } }
},
"a11y": { "noSvgWithoutTitle": "off" },
"nursery": { "noUnusedImports": "off" },
"performance": { "noAccumulatingSpread": "off" },
"correctness": { "noUndeclaredVariables": "off" },
"nursery": {
"noNodejsModules": "off"
},
"suspicious": {
"useAwait": "off",
"noExplicitAny": "off",
"noEmptyInterface": "off",
"noConfusingVoidType": "off"
Expand All @@ -79,6 +117,7 @@
}
},
"javascript": {
"globals": ["NodeJS", "Astro", "NEXT_TELEMETRY_DISABLED"],
"parser": {
"unsafeParameterDecoratorsEnabled": true
},
Expand All @@ -91,8 +130,54 @@
"trailingComma": "all",
"semicolons": "always",
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"arrowParentheses": "always"
"arrowParentheses": "always",
"quoteProperties": "asNeeded"
}
},
"overrides": [
{
"include": ["test", "scripts"],
"linter": {
"rules": {
"suspicious": {
"noConsoleLog": "off"
}
}
}
},
{
"include": ["*.astro"],
"linter": {
"rules": {
"correctness": {
"noUnusedImports": "off"
},
"style": {
"useImportType": "off",
"useFilenamingConvention": "off"
}
}
}
},
{
"include": ["*.svelte"],
"linter": {
"rules": {
"correctness": {
"noUnusedLabels": "off",
"noUnusedImports": "off",
"useHookAtTopLevel": "off"
},
"style": {
"useConst": "off",
"useImportType": "off",
"useFilenamingConvention": "off"
},
"suspicious": {
"noConfusingLabels": "off"
}
}
}
}
}
]
}
Binary file modified bun.lockb
Binary file not shown.
9 changes: 1 addition & 8 deletions examples/astro/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@ import moonlightTheme from './public/theme/moonlight-ii.json';
export default defineConfig({
markdown: {
syntaxHighlight: false,
rehypePlugins: [
[
rehypePrettyCode,
{
theme: moonlightTheme,
},
],
],
rehypePlugins: [[rehypePrettyCode, { theme: moonlightTheme }]],
},
integrations: [mdx(), tailwind()],
});
Binary file modified examples/astro/bun.lockb
Binary file not shown.
12 changes: 6 additions & 6 deletions examples/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^2.1.1",
"@astrojs/mdx": "^2.2.1",
"@astrojs/tailwind": "^5.1.0",
"astro": "^4.4.4",
"astro": "^4.5.9",
"rehype-pretty-code": "^0.13.0",
"shiki": "^1.1.7",
"shiki": "^1.2.0",
"tailwindcss": "^3.4.1"
},
"devDependencies": {
"@types/node": "^20.11.20",
"@astrojs/check": "^0.5.5",
"typescript": "^5.3.3"
"@astrojs/check": "^0.5.10",
"@types/node": "^20.11.30",
"typescript": "^5.4.3"
}
}
4 changes: 3 additions & 1 deletion examples/astro/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "Bundler"
}
},
"include": ["src"],
"files": ["astro.config.ts", "tailwind.config.ts"]
}
33 changes: 15 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
},
"./package.json": "./package.json"
},
"files": [
"dist",
"package.json"
],
"files": ["dist", "package.json"],
"scripts": {
"build": "tsup --config=tsup.config.ts",
"test": "vitest --run",
Expand All @@ -31,7 +28,7 @@
"release": "bumpp package.json --commit --push --tag",
"prebuild": "rm -rf dist",
"prepublishOnly": "NODE_ENV='production' bun run build",
"check-package": "bunx publint@latest --strict && bunx @arethetypeswrong/cli --pack --ignore-rules cjs-resolves-to-esm"
"check-package": "bunx publint@latest --strict && bunx attw --pack --ignore-rules cjs-resolves-to-esm"
},
"dependencies": {
"@types/hast": "^3.0.4",
Expand All @@ -42,22 +39,24 @@
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@biomejs/biome": "^1.5.3",
"@types/bun": "^1.0.7",
"@types/node": "^20.11.20",
"bumpp": "^9.3.0",
"bun": "^1.0.29",
"@arethetypeswrong/cli": "^0.15.2",
"@biomejs/biome": "^1.6.3",
"@shikijs/transformers": "^1.2.0",
"@types/bun": "^1.0.10",
"@types/node": "^20.11.30",
"bumpp": "^9.4.0",
"bun": "^1.0.35",
"hast-util-to-html": "^9.0.0",
"husky": "^9.0.11",
"mdast-util-to-hast": "^13.1.0",
"prettier": "^3.2.5",
"remark": "^15.0.1",
"shiki": "^1.2.0",
"tsup": "^8.0.2",
"typescript": "^5.3.3",
"vite": "^5.1.4",
"vitest": "^1.3.1",
"@shikijs/transformers": "^1.1.7",
"shiki": "^1.1.7"
"tsx": "^4.7.1",
"typescript": "^5.4.3",
"vite": "^5.2.6",
"vitest": "^1.4.0"
},
"peerDependencies": {
"shiki": "^1.0.0"
Expand All @@ -66,9 +65,7 @@
"node": ">=18"
},
"repository": "github:rehype-pretty/rehype-pretty-code",
"browserslist": [
"node 18"
],
"browserslist": ["node 18"],
"author": "https://github.com/atomiks",
"license": "MIT"
}
2 changes: 1 addition & 1 deletion scripts/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ else {
await file(join(import.meta.dir, '../package.json')).text(),
);

const workspaces = packageJson.workspaces as string[];
const workspaces = packageJson.workspaces as Array<string>;
for (const w of workspaces) {
if (w === excluded) continue;
await runScriptForWorkspace(w);
Expand Down
2 changes: 1 addition & 1 deletion src/chars/charsHighlighter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { isElement } from '../utils';
*/
export function charsHighlighter(
element: Element,
charsList: string[],
charsList: Array<string>,
options: CharsHighlighterOptions,
onVisitHighlightedChars?: (
element: CharsElement,
Expand Down
2 changes: 1 addition & 1 deletion src/chars/getElementsToHighlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function getElementsToHighlight(
let charsSoFar = '';

if (element.children) {
const elements = element.children as Element[];
const elements = element.children as Array<Element>;

for (let i = startIndex; i < elements.length; i++) {
const remaining = charsSoFar ? chars.replace(charsSoFar, '') : chars;
Expand Down
Loading

0 comments on commit 2a46074

Please sign in to comment.