storybook-onbook-plugin 0.2.1 → 0.2.3
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/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +395 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +453 -1
- package/dist/screenshot-service/index.d.ts +46 -4
- package/dist/screenshot-service/index.js +213 -5
- package/dist/screenshot-service/utils/browser/index.d.ts +12 -2
- package/dist/screenshot-service/utils/browser/index.js +25 -1
- package/package.json +28 -9
- package/dist/cli/generate-screenshots.d.ts +0 -3
- package/dist/cli/generate-screenshots.d.ts.map +0 -1
- package/dist/cli/generate-screenshots.js +0 -169
- package/dist/component-loc/component-loc.d.ts +0 -7
- package/dist/component-loc/component-loc.d.ts.map +0 -1
- package/dist/component-loc/component-loc.js +0 -58
- package/dist/component-loc/index.d.ts +0 -2
- package/dist/component-loc/index.d.ts.map +0 -1
- package/dist/component-loc/index.js +0 -1
- package/dist/handlers/handleStoryFileChange/handleStoryFileChange.d.ts +0 -3
- package/dist/handlers/handleStoryFileChange/handleStoryFileChange.d.ts.map +0 -1
- package/dist/handlers/handleStoryFileChange/handleStoryFileChange.js +0 -100
- package/dist/handlers/handleStoryFileChange/index.d.ts +0 -2
- package/dist/handlers/handleStoryFileChange/index.d.ts.map +0 -1
- package/dist/handlers/handleStoryFileChange/index.js +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/screenshot-service/constants.d.ts +0 -8
- package/dist/screenshot-service/constants.d.ts.map +0 -1
- package/dist/screenshot-service/constants.js +0 -11
- package/dist/screenshot-service/index.d.ts.map +0 -1
- package/dist/screenshot-service/screenshot-service.d.ts +0 -8
- package/dist/screenshot-service/screenshot-service.d.ts.map +0 -1
- package/dist/screenshot-service/screenshot-service.js +0 -36
- package/dist/screenshot-service/types.d.ts +0 -18
- package/dist/screenshot-service/types.d.ts.map +0 -1
- package/dist/screenshot-service/types.js +0 -1
- package/dist/screenshot-service/utils/browser/browser.d.ts +0 -10
- package/dist/screenshot-service/utils/browser/browser.d.ts.map +0 -1
- package/dist/screenshot-service/utils/browser/browser.js +0 -29
- package/dist/screenshot-service/utils/browser/index.d.ts.map +0 -1
- package/dist/screenshot-service/utils/screenshot/index.d.ts +0 -2
- package/dist/screenshot-service/utils/screenshot/index.d.ts.map +0 -1
- package/dist/screenshot-service/utils/screenshot/index.js +0 -1
- package/dist/screenshot-service/utils/screenshot/screenshot.d.ts +0 -26
- package/dist/screenshot-service/utils/screenshot/screenshot.d.ts.map +0 -1
- package/dist/screenshot-service/utils/screenshot/screenshot.js +0 -128
- package/dist/storybook-onlook-plugin.d.ts +0 -9
- package/dist/storybook-onlook-plugin.d.ts.map +0 -1
- package/dist/storybook-onlook-plugin.js +0 -148
- package/dist/utils/fileSystem/fileSystem.d.ts +0 -9
- package/dist/utils/fileSystem/fileSystem.d.ts.map +0 -1
- package/dist/utils/fileSystem/fileSystem.js +0 -24
- package/dist/utils/fileSystem/index.d.ts +0 -2
- package/dist/utils/fileSystem/index.d.ts.map +0 -1
- package/dist/utils/fileSystem/index.js +0 -1
- package/dist/utils/findGitRoot/findGitRoot.d.ts +0 -5
- package/dist/utils/findGitRoot/findGitRoot.d.ts.map +0 -1
- package/dist/utils/findGitRoot/findGitRoot.js +0 -15
- package/dist/utils/findGitRoot/index.d.ts +0 -2
- package/dist/utils/findGitRoot/index.d.ts.map +0 -1
- package/dist/utils/findGitRoot/index.js +0 -1
- package/dist/utils/manifest/index.d.ts +0 -2
- package/dist/utils/manifest/index.d.ts.map +0 -1
- package/dist/utils/manifest/index.js +0 -1
- package/dist/utils/manifest/manifest.d.ts +0 -21
- package/dist/utils/manifest/manifest.d.ts.map +0 -1
- package/dist/utils/manifest/manifest.js +0 -44
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { computeFileHash, ensureCacheDirectories } from './fileSystem.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findGitRoot.d.ts","sourceRoot":"","sources":["../../../src/utils/findGitRoot/findGitRoot.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW5D"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
/**
|
|
4
|
-
* Find the git repository root by walking up the directory tree
|
|
5
|
-
*/
|
|
6
|
-
export function findGitRoot(startPath) {
|
|
7
|
-
let currentPath = startPath;
|
|
8
|
-
while (currentPath !== dirname(currentPath)) {
|
|
9
|
-
if (existsSync(join(currentPath, '.git'))) {
|
|
10
|
-
return currentPath;
|
|
11
|
-
}
|
|
12
|
-
currentPath = dirname(currentPath);
|
|
13
|
-
}
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/findGitRoot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { findGitRoot } from './findGitRoot.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,MAAM,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { getManifestEntry, loadManifest, saveManifest, updateManifest, } from './manifest.js';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Manifest, ScreenshotMetadata } from '../../screenshot-service/types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Load manifest from disk
|
|
4
|
-
*/
|
|
5
|
-
export declare function loadManifest(): Manifest;
|
|
6
|
-
/**
|
|
7
|
-
* Save manifest to disk
|
|
8
|
-
*/
|
|
9
|
-
export declare function saveManifest(manifest: Manifest): void;
|
|
10
|
-
/**
|
|
11
|
-
* Get manifest entry for a story
|
|
12
|
-
*/
|
|
13
|
-
export declare function getManifestEntry(storyId: string): ScreenshotMetadata | null;
|
|
14
|
-
/**
|
|
15
|
-
* Update manifest for a story
|
|
16
|
-
*/
|
|
17
|
-
export declare function updateManifest(storyId: string, sourcePath: string, fileHash: string, boundingBox?: {
|
|
18
|
-
width: number;
|
|
19
|
-
height: number;
|
|
20
|
-
} | null): void;
|
|
21
|
-
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/utils/manifest/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAGtF;;GAEG;AACH,wBAAgB,YAAY,IAAI,QAAQ,CAMvC;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,QAG9C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAG3E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,QAgBvD"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import { MANIFEST_PATH } from '../../screenshot-service/constants.js';
|
|
3
|
-
import { ensureCacheDirectories } from '../fileSystem/index.js';
|
|
4
|
-
/**
|
|
5
|
-
* Load manifest from disk
|
|
6
|
-
*/
|
|
7
|
-
export function loadManifest() {
|
|
8
|
-
if (fs.existsSync(MANIFEST_PATH)) {
|
|
9
|
-
const content = fs.readFileSync(MANIFEST_PATH, 'utf-8');
|
|
10
|
-
return JSON.parse(content);
|
|
11
|
-
}
|
|
12
|
-
return { stories: {} };
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Save manifest to disk
|
|
16
|
-
*/
|
|
17
|
-
export function saveManifest(manifest) {
|
|
18
|
-
ensureCacheDirectories();
|
|
19
|
-
fs.writeFileSync(MANIFEST_PATH, JSON.stringify(manifest, null, 2));
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Get manifest entry for a story
|
|
23
|
-
*/
|
|
24
|
-
export function getManifestEntry(storyId) {
|
|
25
|
-
const manifest = loadManifest();
|
|
26
|
-
return manifest.stories[storyId] || null;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Update manifest for a story
|
|
30
|
-
*/
|
|
31
|
-
export function updateManifest(storyId, sourcePath, fileHash, boundingBox) {
|
|
32
|
-
const manifest = loadManifest();
|
|
33
|
-
manifest.stories[storyId] = {
|
|
34
|
-
fileHash,
|
|
35
|
-
lastGenerated: new Date().toISOString(),
|
|
36
|
-
sourcePath,
|
|
37
|
-
screenshots: {
|
|
38
|
-
light: `screenshots/${storyId}/light.png`,
|
|
39
|
-
dark: `screenshots/${storyId}/dark.png`,
|
|
40
|
-
},
|
|
41
|
-
boundingBox: boundingBox ?? undefined,
|
|
42
|
-
};
|
|
43
|
-
saveManifest(manifest);
|
|
44
|
-
}
|