react-source-spotlight 1.0.0
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/LICENSE +21 -0
- package/README.md +375 -0
- package/bin/cli.js +28 -0
- package/dist/Spotlight.d.ts +8 -0
- package/dist/Spotlight.d.ts.map +1 -0
- package/dist/SpotlightProvider.d.ts +12 -0
- package/dist/SpotlightProvider.d.ts.map +1 -0
- package/dist/__tests__/setup.d.ts +2 -0
- package/dist/__tests__/setup.d.ts.map +1 -0
- package/dist/cli/Spotlight.d.ts +8 -0
- package/dist/cli/Spotlight.d.ts.map +1 -0
- package/dist/cli/SpotlightProvider.d.ts +12 -0
- package/dist/cli/SpotlightProvider.d.ts.map +1 -0
- package/dist/cli/__tests__/setup.d.ts +2 -0
- package/dist/cli/__tests__/setup.d.ts.map +1 -0
- package/dist/cli/cli/config.d.ts +3 -0
- package/dist/cli/cli/config.d.ts.map +1 -0
- package/dist/cli/cli/generator.d.ts +8 -0
- package/dist/cli/cli/generator.d.ts.map +1 -0
- package/dist/cli/components/CodeModal.d.ts +10 -0
- package/dist/cli/components/CodeModal.d.ts.map +1 -0
- package/dist/cli/components/DevModeToggle.d.ts +7 -0
- package/dist/cli/components/DevModeToggle.d.ts.map +1 -0
- package/dist/cli/config.d.ts +3 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/generator.d.ts +8 -0
- package/dist/cli/generator.d.ts.map +1 -0
- package/dist/cli/generator.js +128 -0
- package/dist/cli/generator.js.map +1 -0
- package/dist/cli/hooks/useSourceSpotlight.d.ts +11 -0
- package/dist/cli/hooks/useSourceSpotlight.d.ts.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/types.d.ts +45 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/components/CodeModal.d.ts +10 -0
- package/dist/components/CodeModal.d.ts.map +1 -0
- package/dist/components/DevModeToggle.d.ts +7 -0
- package/dist/components/DevModeToggle.d.ts.map +1 -0
- package/dist/hooks/useSourceSpotlight.d.ts +11 -0
- package/dist/hooks/useSourceSpotlight.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +3295 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +3300 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +45 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +73 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface SourceData {
|
|
2
|
+
code: string;
|
|
3
|
+
lines: number;
|
|
4
|
+
size: number;
|
|
5
|
+
lastModified: Date;
|
|
6
|
+
}
|
|
7
|
+
export interface SpotlightContextType {
|
|
8
|
+
isDevMode: boolean;
|
|
9
|
+
setIsDevMode: (value: boolean) => void;
|
|
10
|
+
sourceMap: Record<string, SourceData>;
|
|
11
|
+
repoUrl?: string;
|
|
12
|
+
theme: 'light' | 'dark';
|
|
13
|
+
}
|
|
14
|
+
export interface SpotlightConfig {
|
|
15
|
+
input: string;
|
|
16
|
+
output: string;
|
|
17
|
+
exclude?: string[];
|
|
18
|
+
repoUrl?: string;
|
|
19
|
+
features?: {
|
|
20
|
+
cleanCodeBadge?: {
|
|
21
|
+
threshold: number;
|
|
22
|
+
};
|
|
23
|
+
githubLinks?: boolean;
|
|
24
|
+
copyButton?: boolean;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface SpotlightProviderProps {
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
mapUrl?: string;
|
|
30
|
+
repoUrl?: string;
|
|
31
|
+
theme?: 'light' | 'dark';
|
|
32
|
+
}
|
|
33
|
+
export interface SpotlightProps {
|
|
34
|
+
filename: string;
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
export interface DevModeToggleProps {
|
|
38
|
+
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
39
|
+
}
|
|
40
|
+
export interface CodeModalProps {
|
|
41
|
+
filename: string;
|
|
42
|
+
sourceData: SourceData;
|
|
43
|
+
onClose: () => void;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE;QACP,cAAc,CAAC,EAAE;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC;QACvC,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,UAAU,CAAC,EAAE,OAAO,CAAC;KACxB,CAAC;CACL;AAED,MAAM,WAAW,sBAAsB;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,cAAc,GAAG,aAAa,CAAC;CACxE;AAED,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-source-spotlight",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A drop-in package that adds a Developer Mode toggle to portfolios, allowing visitors to see component source code",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"spotlight": "bin/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "rollup -c",
|
|
13
|
+
"dev": "rollup -c -w",
|
|
14
|
+
"test": "vitest",
|
|
15
|
+
"test:coverage": "vitest --coverage",
|
|
16
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
17
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,css}\"",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"react",
|
|
22
|
+
"portfolio",
|
|
23
|
+
"source-code",
|
|
24
|
+
"developer-mode",
|
|
25
|
+
"code-showcase",
|
|
26
|
+
"job-seeker"
|
|
27
|
+
],
|
|
28
|
+
"author": "TAIJULAMAN",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"commander": "^11.1.0",
|
|
32
|
+
"glob": "^10.3.10",
|
|
33
|
+
"chalk": "^5.3.0",
|
|
34
|
+
"prism-react-renderer": "^2.3.1"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"react": "^18.0.0",
|
|
38
|
+
"react-dom": "^18.0.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
42
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
43
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
44
|
+
"@testing-library/react": "^14.1.2",
|
|
45
|
+
"@testing-library/jest-dom": "^6.1.5",
|
|
46
|
+
"@types/node": "^20.10.6",
|
|
47
|
+
"@types/react": "^18.2.46",
|
|
48
|
+
"@types/react-dom": "^18.2.18",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^6.17.0",
|
|
50
|
+
"@typescript-eslint/parser": "^6.17.0",
|
|
51
|
+
"@vitest/coverage-v8": "^1.1.0",
|
|
52
|
+
"eslint": "^8.56.0",
|
|
53
|
+
"eslint-plugin-react": "^7.33.2",
|
|
54
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
55
|
+
"jsdom": "^23.0.1",
|
|
56
|
+
"prettier": "^3.1.1",
|
|
57
|
+
"rollup": "^4.9.2",
|
|
58
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
59
|
+
"tslib": "^2.6.2",
|
|
60
|
+
"typescript": "^5.3.3",
|
|
61
|
+
"vitest": "^1.1.0"
|
|
62
|
+
},
|
|
63
|
+
"files": [
|
|
64
|
+
"dist",
|
|
65
|
+
"bin",
|
|
66
|
+
"README.md",
|
|
67
|
+
"LICENSE"
|
|
68
|
+
],
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "https://github.com/TAIJULAMAN/react-source-spotlight-package"
|
|
72
|
+
}
|
|
73
|
+
}
|