react-lib-tools 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -0
- package/dist/{GettingStartedRoute-LGDNviy5.cjs → GettingStartedRoute-7Aa6it9K.cjs} +2 -2
- package/dist/{GettingStartedRoute-LGDNviy5.cjs.map → GettingStartedRoute-7Aa6it9K.cjs.map} +1 -1
- package/dist/{GettingStartedRoute-DmHalwMP.js → GettingStartedRoute-foIc86s9.js} +2 -2
- package/dist/{GettingStartedRoute-DmHalwMP.js.map → GettingStartedRoute-foIc86s9.js.map} +1 -1
- package/dist/{PageNotFound-DIt5wQ4x.cjs → PageNotFound-BvASwBiY.cjs} +2 -2
- package/dist/{PageNotFound-DIt5wQ4x.cjs.map → PageNotFound-BvASwBiY.cjs.map} +1 -1
- package/dist/{PageNotFound-DuD7brn5.js → PageNotFound-DUjrRqET.js} +2 -2
- package/dist/{PageNotFound-DuD7brn5.js.map → PageNotFound-DUjrRqET.js.map} +1 -1
- package/dist/{SupportRoute-DWEe-0A7.cjs → SupportRoute-9JIclEem.cjs} +2 -2
- package/dist/{SupportRoute-DWEe-0A7.cjs.map → SupportRoute-9JIclEem.cjs.map} +1 -1
- package/dist/{SupportRoute-B9n9OCoW.js → SupportRoute-Dq4qVZXN.js} +2 -2
- package/dist/{SupportRoute-B9n9OCoW.js.map → SupportRoute-Dq4qVZXN.js.map} +1 -1
- package/dist/{VersionsRoute-DOa8Yrmb.js → VersionsRoute-C5U0zY4k.js} +2 -2
- package/dist/{VersionsRoute-DOa8Yrmb.js.map → VersionsRoute-C5U0zY4k.js.map} +1 -1
- package/dist/{VersionsRoute-Br6RZivR.cjs → VersionsRoute-CgKKplVF.cjs} +2 -2
- package/dist/{VersionsRoute-Br6RZivR.cjs.map → VersionsRoute-CgKKplVF.cjs.map} +1 -1
- package/dist/{index-D1Hn63kY.js → index-DcYrvRB4.js} +23 -32
- package/dist/{index-D1Hn63kY.js.map → index-DcYrvRB4.js.map} +1 -1
- package/dist/{index-DleNtYr0.cjs → index-qm845CuF.cjs} +2 -2
- package/dist/{index-DleNtYr0.cjs.map → index-qm845CuF.cjs.map} +1 -1
- package/dist/react-lib-tools.cjs +1 -1
- package/dist/react-lib-tools.d.ts +3 -0
- package/dist/react-lib-tools.js +1 -1
- package/package.json +7 -2
- package/scripts/compile-docs.ts +23 -4
- package/scripts/compile-examples.ts +22 -5
- package/scripts/compress-og-image.ts +38 -0
- package/scripts/utils/docs/compileComponents.ts +3 -3
- package/scripts/utils/docs/compileImperativeHandles.ts +3 -3
- package/scripts/utils/initialize.ts +3 -3
package/dist/react-lib-tools.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-qm845CuF.cjs");exports.AppRoot=e.AppRoot;exports.Block=e.Block;exports.Box=e.Box;exports.Button=e.Button;exports.Callout=e.Callout;exports.Checkbox=e.Checkbox;exports.Code=e.Code;exports.ComponentProps=e.ComponentProps;exports.ComponentPropsSection=e.ComponentPropsSection;exports.DocsSection=e.DocsSection;exports.ErrorBoundary=e.ErrorBoundary;exports.ExternalLink=e.ExternalLink;exports.Header=e.Header;exports.ImperativeHandle=e.ImperativeHandle;exports.Input=e.Input;exports.Link=e.Link;exports.LoadingSpinner=e.LoadingSpinner;exports.NavLink=e.NavLink;exports.NavSection=e.NavSection;exports.Radio=e.Radio;exports.Select=e.Select;exports.assert=e.assert;exports.cn=e.cn;exports.getIntentClassNames=e.getIntentClassNames;
|
|
2
2
|
//# sourceMappingURL=react-lib-tools.cjs.map
|
|
@@ -11,6 +11,9 @@ import { MouseEvent as MouseEvent_2 } from 'react';
|
|
|
11
11
|
import { PropsWithChildren } from 'react';
|
|
12
12
|
import { ReactNode } from 'react';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Displays an application shell with desktop and mobile layouts.
|
|
16
|
+
*/
|
|
14
17
|
export declare function AppRoot({ navLinks, overview, packageDescription, packageName, routes, showOpenCollectLink, versions }: {
|
|
15
18
|
navLinks: ReactNode;
|
|
16
19
|
overview?: ReactNode | undefined;
|
package/dist/react-lib-tools.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as o, a as e, B as n, b as t, C as r, c as i, d as p, i as c, j as l, D as d, e as C, E as k, H as m, I as B, f as L, L as S, g as u, N as x, h as I, R as N, k as g, l as v, m as E, n as H } from "./index-
|
|
1
|
+
import { A as o, a as e, B as n, b as t, C as r, c as i, d as p, i as c, j as l, D as d, e as C, E as k, H as m, I as B, f as L, L as S, g as u, N as x, h as I, R as N, k as g, l as v, m as E, n as H } from "./index-DcYrvRB4.js";
|
|
2
2
|
export {
|
|
3
3
|
o as AppRoot,
|
|
4
4
|
e as Block,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-lib-tools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
|
|
6
6
|
"contributors": [
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@csstools/postcss-oklab-function": "^4.0.11",
|
|
57
57
|
"@eslint/js": "^9.30.1",
|
|
58
|
+
"@floating-ui/react": "^0.27.16",
|
|
58
59
|
"@headlessui/react": "^2.2.4",
|
|
59
60
|
"@headlessui/tailwindcss": "^0.2.2",
|
|
60
61
|
"@heroicons/react": "^2.2.0",
|
|
@@ -63,13 +64,16 @@
|
|
|
63
64
|
"@testing-library/jest-dom": "^6.6.4",
|
|
64
65
|
"@testing-library/react": "^16.3.0",
|
|
65
66
|
"@testing-library/user-event": "^14.6.1",
|
|
67
|
+
"@types/bytes": "^3.1.5",
|
|
66
68
|
"@types/compression": "^1.8.1",
|
|
67
69
|
"@types/express": "^5.0.5",
|
|
68
70
|
"@types/markdown-it": "^14.1.2",
|
|
69
71
|
"@types/node": "^24.2.0",
|
|
70
72
|
"@types/react": "^19.1.8",
|
|
71
73
|
"@types/react-dom": "^19.2.3",
|
|
74
|
+
"@types/sharp": "^0.32.0",
|
|
72
75
|
"@vitejs/plugin-react-swc": "^3.10.2",
|
|
76
|
+
"bytes": "^3.1.2",
|
|
73
77
|
"clsx": "^2.1.1",
|
|
74
78
|
"compression": "^1.8.1",
|
|
75
79
|
"csstype": "^3.1.3",
|
|
@@ -94,6 +98,7 @@
|
|
|
94
98
|
"rollup-plugin-terser": "^7.0.2",
|
|
95
99
|
"rollup-plugin-visualizer": "^6.0.3",
|
|
96
100
|
"rollup-preserve-directives": "^1.1.3",
|
|
101
|
+
"sharp": "^0.34.5",
|
|
97
102
|
"sirv": "^3.0.2",
|
|
98
103
|
"tailwind-merge": "^3.3.1",
|
|
99
104
|
"tailwindcss": "^4.1.11",
|
|
@@ -104,10 +109,10 @@
|
|
|
104
109
|
"typescript-eslint": "^8.35.1",
|
|
105
110
|
"typescript-json-schema": "^0.65.1",
|
|
106
111
|
"vite": "^7.0.4",
|
|
107
|
-
"vitest-fail-on-console": "^0.10.1",
|
|
108
112
|
"vite-plugin-dts": "^4.5.4",
|
|
109
113
|
"vite-plugin-svgr": "^4.3.0",
|
|
110
114
|
"vitest": "^3.2.4",
|
|
115
|
+
"vitest-fail-on-console": "^0.10.1",
|
|
111
116
|
"zustand": "^5.0.7"
|
|
112
117
|
}
|
|
113
118
|
}
|
package/scripts/compile-docs.ts
CHANGED
|
@@ -10,16 +10,35 @@ import {
|
|
|
10
10
|
ScriptTarget
|
|
11
11
|
} from "typescript";
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Compile TSDoc comments into a formatted structure that can be rendered by the `ComponentProps` component.
|
|
15
|
+
*/
|
|
13
16
|
export async function compileDocs({
|
|
14
17
|
analyserOptions: analyserOptionsParam,
|
|
15
18
|
componentNames = [],
|
|
16
19
|
imperativeHandleNames = [],
|
|
17
|
-
|
|
20
|
+
outputPath = ["public", "generated", "docs"]
|
|
18
21
|
}: {
|
|
22
|
+
/**
|
|
23
|
+
* AST Parser config; see `@ts-ast-parser/core` documentation for more information.
|
|
24
|
+
*/
|
|
19
25
|
analyserOptions?: Partial<AnalyserOptions>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Which components should be compiled?
|
|
29
|
+
*/
|
|
20
30
|
componentNames?: string[] | undefined;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Which imperative handles should be compiled?
|
|
34
|
+
*/
|
|
21
35
|
imperativeHandleNames?: string[] | undefined;
|
|
22
|
-
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Where should the output be stored?
|
|
39
|
+
* By default examples are stored within the `public/generated/docs` directory.
|
|
40
|
+
*/
|
|
41
|
+
outputPath?: string[] | undefined;
|
|
23
42
|
}) {
|
|
24
43
|
const compilerOptions: Partial<CompilerOptions> = {
|
|
25
44
|
...defaultCompilerOptions,
|
|
@@ -35,13 +54,13 @@ export async function compileDocs({
|
|
|
35
54
|
await compileComponents({
|
|
36
55
|
compilerOptions,
|
|
37
56
|
componentNames,
|
|
38
|
-
|
|
57
|
+
outputPath
|
|
39
58
|
});
|
|
40
59
|
|
|
41
60
|
await compileImperativeHandles({
|
|
42
61
|
analyserOptions,
|
|
43
62
|
names: imperativeHandleNames,
|
|
44
|
-
|
|
63
|
+
outputPath
|
|
45
64
|
});
|
|
46
65
|
}
|
|
47
66
|
|
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
import { readFile, writeFile } from "node:fs/promises";
|
|
2
2
|
import { basename, join } from "node:path";
|
|
3
|
+
import { trimExcludedText } from "./utils/examples/trimExcludedText.ts";
|
|
3
4
|
import { initialize } from "./utils/initialize.ts";
|
|
4
5
|
import { syntaxHighlight } from "./utils/syntax-highlight.ts";
|
|
5
|
-
import { trimExcludedText } from "./utils/examples/trimExcludedText.ts";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Compile example snippets into syntax-highlighted HTML that can be rendered by the `Code` component.
|
|
9
|
+
*/
|
|
7
10
|
export async function compileExamples({
|
|
8
|
-
fileExtensions = [".css", ".html", ".ts", ".tsx"],
|
|
11
|
+
fileExtensions = [".css", ".html", ".js", ".jsx", ".ts", ".tsx"],
|
|
9
12
|
inputPath = ["src", "routes"],
|
|
10
|
-
|
|
13
|
+
outputPath = ["public", "generated", "examples"]
|
|
11
14
|
}: {
|
|
15
|
+
/**
|
|
16
|
+
* Which file extension are supported?
|
|
17
|
+
* By default CSS, HTML, TS/TSX, and JS/JSX file extensions are supported.
|
|
18
|
+
*/
|
|
12
19
|
fileExtensions?: string[] | undefined;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Where are example files located?
|
|
23
|
+
* By default this script looks for examples within the `src/routes` root directory.
|
|
24
|
+
*/
|
|
13
25
|
inputPath?: string[] | undefined;
|
|
14
|
-
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Where should the output be stored?
|
|
29
|
+
* By default examples are stored within the `public/generated/examples` directory.
|
|
30
|
+
*/
|
|
31
|
+
outputPath?: string[] | undefined;
|
|
15
32
|
} = {}) {
|
|
16
33
|
const { files, outputDir } = await initialize({
|
|
17
34
|
fileExtensions,
|
|
18
35
|
inputPath,
|
|
19
|
-
|
|
36
|
+
outputPath
|
|
20
37
|
});
|
|
21
38
|
|
|
22
39
|
for (const file of files) {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import bytes from "bytes";
|
|
2
|
+
import { stat, writeFile } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { cwd } from "node:process";
|
|
5
|
+
import sharp from "sharp";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Compress og:image.
|
|
9
|
+
*/
|
|
10
|
+
export async function compressOgImage({
|
|
11
|
+
inputPath = ["public", "og.png"],
|
|
12
|
+
outputPath = ["public", "og.png"]
|
|
13
|
+
}: {
|
|
14
|
+
inputPath?: string[] | undefined;
|
|
15
|
+
outputPath?: string[] | undefined;
|
|
16
|
+
} = {}) {
|
|
17
|
+
const input = join(cwd(), ...inputPath);
|
|
18
|
+
const statsBefore = await stat(input);
|
|
19
|
+
|
|
20
|
+
const png = sharp(input).png({
|
|
21
|
+
quality: 100,
|
|
22
|
+
compressionLevel: 9
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const output = join(cwd(), ...outputPath);
|
|
26
|
+
const buffer = await png.toBuffer();
|
|
27
|
+
await writeFile(output, buffer, {
|
|
28
|
+
encoding: "base64"
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const statsAfter = await stat(output);
|
|
32
|
+
|
|
33
|
+
console.log(
|
|
34
|
+
"Compressed image:\n before: %s\n after: %s",
|
|
35
|
+
bytes(statsBefore.size),
|
|
36
|
+
bytes(statsAfter.size)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -10,11 +10,11 @@ import { insertPropsMarkdown } from "./insertPropsMarkdown.ts";
|
|
|
10
10
|
export async function compileComponents({
|
|
11
11
|
compilerOptions,
|
|
12
12
|
componentNames,
|
|
13
|
-
|
|
13
|
+
outputPath
|
|
14
14
|
}: {
|
|
15
15
|
compilerOptions: Partial<CompilerOptions>;
|
|
16
16
|
componentNames: string[];
|
|
17
|
-
|
|
17
|
+
outputPath: string[];
|
|
18
18
|
}) {
|
|
19
19
|
const parser = withCompilerOptions(compilerOptions, {
|
|
20
20
|
savePropValueAsString: true,
|
|
@@ -30,7 +30,7 @@ export async function compileComponents({
|
|
|
30
30
|
file.includes(`${componentName}.ts`)
|
|
31
31
|
),
|
|
32
32
|
inputPath: ["lib", "components"],
|
|
33
|
-
|
|
33
|
+
outputPath
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
const markdownPath = join(cwd(), "README.md");
|
|
@@ -10,13 +10,13 @@ import { compileImperativeHandle } from "./compileImperativeHandle.ts";
|
|
|
10
10
|
export async function compileImperativeHandles({
|
|
11
11
|
analyserOptions,
|
|
12
12
|
names,
|
|
13
|
-
|
|
13
|
+
outputPath
|
|
14
14
|
}: {
|
|
15
15
|
analyserOptions: Partial<AnalyserOptions>;
|
|
16
16
|
names: string[];
|
|
17
|
-
|
|
17
|
+
outputPath: string[];
|
|
18
18
|
}) {
|
|
19
|
-
const outputDir = join(cwd(),
|
|
19
|
+
const outputDir = join(cwd(), ...outputPath);
|
|
20
20
|
|
|
21
21
|
const result = await parseFromProject(analyserOptions);
|
|
22
22
|
const reflectedModules = result.project?.getModules() ?? [];
|
|
@@ -8,15 +8,15 @@ export async function initialize({
|
|
|
8
8
|
fileExtensions,
|
|
9
9
|
fileFilter,
|
|
10
10
|
inputPath,
|
|
11
|
-
|
|
11
|
+
outputPath
|
|
12
12
|
}: {
|
|
13
13
|
fileExtensions: string[];
|
|
14
14
|
fileFilter?: ((path: string) => boolean) | undefined;
|
|
15
15
|
inputPath: string[];
|
|
16
|
-
|
|
16
|
+
outputPath: string[];
|
|
17
17
|
}) {
|
|
18
18
|
const inputDir = join(cwd(), ...inputPath);
|
|
19
|
-
const outputDir = join(cwd(),
|
|
19
|
+
const outputDir = join(cwd(), ...outputPath);
|
|
20
20
|
await mkdir(outputDir, { recursive: true });
|
|
21
21
|
await rmFilesWithExtensions(outputDir, [".json"]);
|
|
22
22
|
|