Skip to content

Commit

Permalink
feat: reduce build
Browse files Browse the repository at this point in the history
  • Loading branch information
jer3m01 committed Feb 10, 2024
1 parent 9e8b538 commit f90caed
Show file tree
Hide file tree
Showing 8 changed files with 370 additions and 152 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ lerna-debug.log
# kobalte dev
packages/core/dev/App.tsx
packages/core/dev/index.css
packages/core/NOTICE.txt

# VSC Settings
.vscode/settings.json
Expand Down
5 changes: 3 additions & 2 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"author": "Fabien Marie-Louise <[email protected]>",
"type": "module",
"scripts": {
"build": "vinxi build",
"build": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vinxi build",
"clean": "rm -rf .solid && rm -rf netlify && rm -rf .turbo && rm -rf node_modules && rm -rf dist",
"dev": "vinxi dev --host",
"start": "vinxi start"
Expand Down Expand Up @@ -63,7 +63,8 @@
"typescript": "4.9.5",
"unist-util-visit": "5.0.0",
"vite": "5.0.12",
"@vinxi/plugin-mdx": "3.7.1"
"@vinxi/plugin-mdx": "3.7.1",
"cross-env": "7.0.3"
},
"engines": {
"node": ">=18"
Expand Down
23 changes: 9 additions & 14 deletions apps/docs/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ export default defineConfig({
jsxImportSource: "solid-js",
providerImportSource: "solid-mdx",
rehypePlugins: [
[rehypeRaw, { passThrough: nodeTypes }],
rehypePrettyCode,
rehypeSlug,
[rehypeRaw, { passThrough: nodeTypes }],
rehypeCollectHeadings,
],
remarkPlugins: [
Expand Down Expand Up @@ -163,20 +163,15 @@ export default defineConfig({
if (id.endsWith(".mdx?meta") || id.endsWith(".md?meta")) {
const replacedId = id.replace(/\?meta$/, "");

function getCode() {
return `
export function getHeadings() { return ${JSON.stringify(
headingsCache.get(replacedId),
null,
2,
)}
}
`;
if (headingsCache.has(replacedId)) {
return {
code: `
export function getHeadings() {
return ${JSON.stringify(headingsCache.get(id), null, 2)}
}
`,
};
}

return {
code: getCode(),
};
}
},
},
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@
"turbo": "1.10.13",
"typescript": "4.9.5",
"vite": "5.0.11",
"vite-plugin-solid": "2.8.0"
"vite-plugin-solid": "2.9.1",
"rollup-plugin-cleanup": "3.2.1",
"rollup-plugin-license": "3.2.0",
"rollup-plugin-copy": "3.5.0"
},
"packageManager": "[email protected]"
}
5 changes: 3 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"files": [
"dist"
"dist",
"NOTICE.txt"
],
"scripts": {
"build": "rollup -c",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm NOTICE.txt",
"dev": "vite serve dev --host",
"test": "jest --passWithNoTests",
"typecheck": "tsc --noEmit"
Expand Down
28 changes: 28 additions & 0 deletions packages/core/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
import cleanup from "rollup-plugin-cleanup";
import copy from "rollup-plugin-copy";
import license from "rollup-plugin-license";
import withSolid from "rollup-preset-solid";

export default withSolid({
input: "src/index.tsx",
targets: ["esm", "cjs"],
plugins: [
cleanup({
comments: "none",
extensions: ["ts", "tsx"],
}),
license({
banner: `
MIT License
Copyright (c) 2022 Fabien Marie-Louise
License can be found in LICENSE.md,
also available at https://github.com/kobaltedev/kobalte/blob/main/LICENSE.md
This codebase contains modified portions of code from multiple sources.
Credits to their original authors.
A list of all sources and licenses can be found in NOTICE.txt,
also available at https://github.com/kobaltedev/kobalte/blob/main/NOTICE.txt
`,
}),
copy({
targets: [{ src: "../../NOTICE.txt", dest: "." }],
}),
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import {
untrack,
} from "solid-js";
import { isServer } from "solid-js/web";
import { Axis, createStyle, getScrollAtLocation } from "..";
import { createStyle } from "./create-style";
import { Axis, getScrollAtLocation } from "./scroll";

const [preventScrollStack, setPreventScrollStack] = createSignal<string[]>([]);
const [resetCallback, setResetCallback] = createSignal(() => {});
Expand Down
Loading

0 comments on commit f90caed

Please sign in to comment.