@skspwork/config-doc 0.4.2 → 0.4.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skspwork/config-doc",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Interactive documentation tool for JSON configuration files (appsettings.json)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "cd packages/web && npm install && npm run build && cd ../.. && node scripts/prepare-standalone.js",
|
|
45
45
|
"prepublishOnly": "npm run build",
|
|
46
|
-
"test:local": "npm pack && npm install -g skspwork-config-doc-0.4.
|
|
46
|
+
"test:local": "npm pack && npm install -g skspwork-config-doc-0.4.3.tgz",
|
|
47
47
|
"unlink": "npm unlink -g @skspwork/config-doc"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports=[50873,e=>{"use strict";var t=e.i(74930),n=e.i(76450),
|
|
1
|
+
module.exports=[50873,e=>{"use strict";var t=e.i(74930),n=e.i(76450),o=e.i(79136),r=e.i(34106),i=e.i(93251),a=e.i(74024),s=e.i(31830),l=e.i(5105),c=e.i(43062),d=e.i(70363),p=e.i(23576),u=e.i(89474),f=e.i(13448),h=e.i(46039),g=e.i(18972),m=e.i(93695);e.i(93699);var b=e.i(58282),x=e.i(9280),v=e.i(79615),y=e.i(51958);class w{fsService;storageService;constructor(e){this.fsService=new v.FileSystemService(e),this.storageService=new y.StorageService(this.fsService)}async generateHtml(){let e=await this.fsService.loadProjectSettings();if(!e||!e.configFiles||0===e.configFiles.length)return this.generateEmptyHtml();let t=[];for(let n of e.configFiles)try{let e=n.split(/[/\\]/).pop()||"config.json",o=this.storageService.getDocsFileName(n),r=await this.fsService.loadConfigFile(n),i=await this.fsService.loadConfigDocs(o);t.push({filePath:n,fileName:e,configData:r,docs:i||{configFilePath:n,lastModified:new Date().toISOString(),properties:{}}})}catch(e){console.error(`Failed to load config: ${n}`,e)}let n={projectName:e.projectName,createdAt:"",lastModified:new Date().toISOString(),configFiles:[]};return this.generateFullHtml(n,t)}generateEmptyHtml(){return`<!DOCTYPE html>
|
|
2
2
|
<html lang="ja">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
@@ -519,14 +519,35 @@ module.exports=[50873,e=>{"use strict";var t=e.i(74930),n=e.i(76450),r=e.i(79136
|
|
|
519
519
|
renderTree(tree, treeEl);
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
-
//
|
|
522
|
+
// 検索フィルタを適用(ツリー項目のフィルタリング - プロパティ名、パス、説明、備考を検索)
|
|
523
523
|
function applySearchFilter(query) {
|
|
524
|
+
const config = configs[activeConfigIndex];
|
|
524
525
|
const items = document.querySelectorAll('.tree-item');
|
|
526
|
+
|
|
525
527
|
items.forEach(item => {
|
|
526
528
|
const text = item.textContent.toLowerCase();
|
|
527
529
|
const path = item.dataset.path.toLowerCase();
|
|
530
|
+
let matched = false;
|
|
528
531
|
|
|
532
|
+
// プロパティ名とパスで検索
|
|
529
533
|
if (text.includes(query) || path.includes(query)) {
|
|
534
|
+
matched = true;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
// ドキュメント(説明と備考)でも検索
|
|
538
|
+
if (!matched) {
|
|
539
|
+
const doc = config.docs.properties && config.docs.properties[item.dataset.path];
|
|
540
|
+
if (doc) {
|
|
541
|
+
const description = (doc.description || '').toLowerCase();
|
|
542
|
+
const notes = (doc.notes || '').toLowerCase();
|
|
543
|
+
|
|
544
|
+
if (description.includes(query) || notes.includes(query)) {
|
|
545
|
+
matched = true;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
if (matched) {
|
|
530
551
|
item.style.display = '';
|
|
531
552
|
// 親要素も表示
|
|
532
553
|
let parent = item.parentElement;
|
|
@@ -560,7 +581,7 @@ module.exports=[50873,e=>{"use strict";var t=e.i(74930),n=e.i(76450),r=e.i(79136
|
|
|
560
581
|
let foundInConfigs = [];
|
|
561
582
|
configs.forEach((config, index) => {
|
|
562
583
|
const tree = buildTree(config.configData, '', config.docs);
|
|
563
|
-
const hasMatch =
|
|
584
|
+
const hasMatch = searchInTreeForConfig(tree, query, config);
|
|
564
585
|
if (hasMatch) {
|
|
565
586
|
foundInConfigs.push(index);
|
|
566
587
|
}
|
|
@@ -581,18 +602,30 @@ module.exports=[50873,e=>{"use strict";var t=e.i(74930),n=e.i(76450),r=e.i(79136
|
|
|
581
602
|
});
|
|
582
603
|
}
|
|
583
604
|
|
|
584
|
-
//
|
|
585
|
-
function
|
|
605
|
+
// ツリー内を検索してマッチするか判定(特定の設定ファイル用)
|
|
606
|
+
function searchInTreeForConfig(nodes, query, config) {
|
|
586
607
|
for (const node of nodes) {
|
|
587
608
|
const text = node.key.toLowerCase();
|
|
588
609
|
const path = node.path.toLowerCase();
|
|
589
610
|
|
|
611
|
+
// プロパティ名とパスで検索
|
|
590
612
|
if (text.includes(query) || path.includes(query)) {
|
|
591
613
|
return true;
|
|
592
614
|
}
|
|
593
615
|
|
|
616
|
+
// ドキュメント(説明と備考)でも検索
|
|
617
|
+
const doc = config.docs.properties && config.docs.properties[node.path];
|
|
618
|
+
if (doc) {
|
|
619
|
+
const description = (doc.description || '').toLowerCase();
|
|
620
|
+
const notes = (doc.notes || '').toLowerCase();
|
|
621
|
+
|
|
622
|
+
if (description.includes(query) || notes.includes(query)) {
|
|
623
|
+
return true;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
594
627
|
if (node.children && node.children.length > 0) {
|
|
595
|
-
if (
|
|
628
|
+
if (searchInTreeForConfig(node.children, query, config)) {
|
|
596
629
|
return true;
|
|
597
630
|
}
|
|
598
631
|
}
|
|
@@ -613,41 +646,41 @@ module.exports=[50873,e=>{"use strict";var t=e.i(74930),n=e.i(76450),r=e.i(79136
|
|
|
613
646
|
renderCurrentConfig();
|
|
614
647
|
setupSearch();
|
|
615
648
|
}
|
|
616
|
-
`}escapeHtml(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}}class C{rootPath;constructor(e){this.rootPath=e}async generateMarkdown(){let e=new v.FileSystemService(this.rootPath),t=new y.StorageService(e),n=await e.loadProjectSettings();if(!n||0===n.configFiles.length)return"# 設定ファイルドキュメント\n\nドキュメント化された設定ファイルがありません。\n";let
|
|
649
|
+
`}escapeHtml(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}}class C{rootPath;constructor(e){this.rootPath=e}async generateMarkdown(){let e=new v.FileSystemService(this.rootPath),t=new y.StorageService(e),n=await e.loadProjectSettings();if(!n||0===n.configFiles.length)return"# 設定ファイルドキュメント\n\nドキュメント化された設定ファイルがありません。\n";let o="# 設定ファイルドキュメント\n\n";for(let e of(o+=`プロジェクト: **${n.projectName}**
|
|
617
650
|
|
|
618
651
|
最終更新: ${new Date().toLocaleString("ja-JP")}
|
|
619
652
|
|
|
620
653
|
---
|
|
621
654
|
|
|
622
|
-
`,n.configFiles)){let n=e.split(/[/\\]/).pop()||"config.json",
|
|
655
|
+
`,n.configFiles)){let n=e.split(/[/\\]/).pop()||"config.json",r=await t.loadAllDocs(e);o+=`## ${n}
|
|
623
656
|
|
|
624
657
|
**ファイルパス:** \`${e}\`
|
|
625
658
|
|
|
626
|
-
`;let
|
|
659
|
+
`;let i=Object.entries(r.properties);if(0===i.length){o+="*ドキュメントが登録されていません。*\n\n";continue}for(let[e,t]of(o+="### プロパティ一覧\n\n",i))o+=`#### \`${e}\`
|
|
627
660
|
|
|
628
|
-
`,t.description&&(
|
|
661
|
+
`,t.description&&(o+=`**説明:**
|
|
629
662
|
|
|
630
663
|
${t.description}
|
|
631
664
|
|
|
632
|
-
`),t.notes&&(
|
|
665
|
+
`),t.notes&&(o+=`**備考:**
|
|
633
666
|
|
|
634
667
|
${t.notes}
|
|
635
668
|
|
|
636
|
-
`),
|
|
669
|
+
`),o+="---\n\n"}return o+`
|
|
637
670
|
*このドキュメントは [ConfigDoc](https://github.com/your-repo/configdoc) により自動生成されました。*
|
|
638
|
-
`}}class E{rootPath;constructor(e){this.rootPath=e}async generateMarkdownTable(){let e=new v.FileSystemService(this.rootPath),t=new y.StorageService(e),n=await e.loadProjectSettings();if(!n||0===n.configFiles.length)return"# 設定ファイルドキュメント\n\nドキュメント化された設定ファイルがありません。\n";let
|
|
671
|
+
`}}class E{rootPath;constructor(e){this.rootPath=e}async generateMarkdownTable(){let e=new v.FileSystemService(this.rootPath),t=new y.StorageService(e),n=await e.loadProjectSettings();if(!n||0===n.configFiles.length)return"# 設定ファイルドキュメント\n\nドキュメント化された設定ファイルがありません。\n";let o="# 設定ファイルドキュメント\n\n";for(let r of(o+=`プロジェクト: **${n.projectName}**
|
|
639
672
|
|
|
640
673
|
最終更新: ${new Date().toLocaleString("ja-JP")}
|
|
641
674
|
|
|
642
675
|
---
|
|
643
676
|
|
|
644
|
-
`,n.configFiles)){let n=
|
|
677
|
+
`,n.configFiles)){let n=r.split(/[/\\]/).pop()||"config.json",i=await t.loadAllDocs(r),a=await e.loadConfigFile(r);o+=`## ${n}
|
|
645
678
|
|
|
646
|
-
**ファイルパス:** \`${
|
|
679
|
+
**ファイルパス:** \`${r}\`
|
|
647
680
|
|
|
648
|
-
`;let
|
|
649
|
-
`}
|
|
681
|
+
`;let s=Object.entries(i.properties);if(0===s.length){o+="*ドキュメントが登録されていません。*\n\n";continue}for(let[e,t]of(o+="| プロパティ名 | 説明 | 値 | 備考 |\n|-------------|------|-----|------|\n",s)){let n=this.escapeTableCell(e),r=this.escapeTableCell(t.description||"-"),i=this.getPropertyValue(a,e),s=this.escapeTableCell(i),l=this.escapeTableCell(t.notes||"-");o+=`| ${n} | ${r} | ${s} | ${l} |
|
|
682
|
+
`}o+="\n"}return o+`
|
|
650
683
|
*このドキュメントは [ConfigDoc](https://github.com/your-repo/configdoc) により自動生成されました。*
|
|
651
|
-
`}getPropertyValue(e,t){let n=t.split(":"),
|
|
684
|
+
`}getPropertyValue(e,t){let n=t.split(":"),o=e;for(let e of n)if(!o||"object"!=typeof o||!(e in o))return"-";else o=o[e];return null==o?"-":"object"==typeof o?JSON.stringify(o):String(o)}escapeTableCell(e){return e.replace(/\|/g,"\\|").replace(/\n/g,"<br>").replace(/\r/g,"")}}var S=e.i(66823),T=e.i(14747),R=e.i(24868);async function k(e){try{let t,n=(0,S.getRootPath)(),{format:o="html",fileName:r="config-doc"}=await e.json();if("markdown"===o){let e=new C(n);t=await e.generateMarkdown()}else if("markdown-table"===o){let e=new E(n);t=await e.generateMarkdownTable()}else{let e=new w(n);t=await e.generateHtml()}let i=`${r}.${"markdown"===o||"markdown-table"===o?"md":"html"}`,a=new v.FileSystemService(n);await a.ensureConfigDocDir();let s=T.default.join(n,".config_doc","output",i),l=T.default.dirname(s);return await R.default.mkdir(l,{recursive:!0}),await R.default.writeFile(s,t,"utf-8"),x.NextResponse.json({success:!0,message:`${"markdown"===o?"Markdown":"HTML"}ファイルを生成しました`,outputPath:s})}catch(e){return console.error("API Error:",e),x.NextResponse.json({success:!1,error:e instanceof Error?e.message:"Unknown error"},{status:500})}}e.s(["POST",()=>k],1882);var D=e.i(1882);let N=new t.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/export/route",pathname:"/api/export",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/packages/web/app/api/export/route.ts",nextConfigOutput:"standalone",userland:D}),{workAsyncStorage:P,workUnitAsyncStorage:I,serverHooks:$}=N;function H(){return(0,o.patchFetch)({workAsyncStorage:P,workUnitAsyncStorage:I})}async function j(e,t,o){N.isDev&&(0,r.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/api/export/route";x=x.replace(/\/index$/,"")||"/";let v=await N.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==o.waitUntil||o.waitUntil.call(o,Promise.resolve()),null;let{buildId:y,params:w,nextConfig:C,parsedUrl:E,isDraftMode:S,prerenderManifest:T,routerServerContext:R,isOnDemandRevalidate:k,revalidateOnlyGenerated:D,resolvedPathname:P,clientReferenceManifest:I,serverActionsManifest:$}=v,H=(0,s.normalizeAppPath)(x),j=!!(T.dynamicRoutes[H]||T.routes[P]),A=async()=>((null==R?void 0:R.render404)?await R.render404(e,t,E,!1):t.end("This page could not be found"),null);if(j&&!S){let e=!!T.routes[P],t=T.dynamicRoutes[H];if(t&&!1===t.fallback&&!e){if(C.experimental.adapterPath)return await A();throw new m.NoFallbackError}}let F=null;!j||N.isDev||S||(F="/index"===(F=P)?"/":F);let L=!0===N.isDev||!j,q=j&&!L;$&&I&&(0,a.setManifestsSingleton)({page:x,clientReferenceManifest:I,serverActionsManifest:$});let O=e.method||"GET",M=(0,i.getTracer)(),U=M.getActiveScopeSpan(),_={params:w,prerenderManifest:T,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:L,incrementalCache:(0,r.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:C.cacheLife,waitUntil:o.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,n,o,r)=>N.onRequestError(e,t,o,r,R)},sharedContext:{buildId:y}},z=new l.NodeNextRequest(e),B=new l.NodeNextResponse(t),K=c.NextRequestAdapter.fromNodeNextRequest(z,(0,c.signalFromNodeResponse)(t));try{let a=async e=>N.handle(K,_).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let n=M.getRootSpanAttributes();if(!n)return;if(n.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${n.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let o=n.get("next.route");if(o){let t=`${O} ${o}`;e.setAttributes({"next.route":o,"http.route":o,"next.span_name":t}),e.updateName(t)}else e.updateName(`${O} ${x}`)}),s=!!(0,r.getRequestMeta)(e,"minimalMode"),l=async r=>{var i,l;let c=async({previousCacheEntry:n})=>{try{if(!s&&k&&D&&!n)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await a(r);e.fetchMetrics=_.renderOpts.fetchMetrics;let l=_.renderOpts.pendingWaitUntil;l&&o.waitUntil&&(o.waitUntil(l),l=void 0);let c=_.renderOpts.collectedTags;if(!j)return await (0,u.sendResponse)(z,B,i,_.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(i.headers);c&&(t[g.NEXT_CACHE_TAGS_HEADER]=c),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let n=void 0!==_.renderOpts.collectedRevalidate&&!(_.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&_.renderOpts.collectedRevalidate,o=void 0===_.renderOpts.collectedExpire||_.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:_.renderOpts.collectedExpire;return{value:{kind:b.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:n,expire:o}}}}catch(t){throw(null==n?void 0:n.isStale)&&await N.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:q,isOnDemandRevalidate:k})},!1,R),t}},d=await N.handleResponse({req:e,nextConfig:C,cacheKey:F,routeKind:n.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:T,isRoutePPREnabled:!1,isOnDemandRevalidate:k,revalidateOnlyGenerated:D,responseGenerator:c,waitUntil:o.waitUntil,isMinimalMode:s});if(!j)return null;if((null==d||null==(i=d.value)?void 0:i.kind)!==b.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(l=d.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});s||t.setHeader("x-nextjs-cache",k?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),S&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return s&&j||m.delete(g.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,u.sendResponse)(z,B,new Response(d.value.body,{headers:m,status:d.value.status||200})),null};U?await l(U):await M.withPropagatedContext(e.headers,()=>M.trace(d.BaseServerSpan.handleRequest,{spanName:`${O} ${x}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":e.url}},l))}catch(t){if(t instanceof m.NoFallbackError||await N.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:q,isOnDemandRevalidate:k})},!1,R),j)throw t;return await (0,u.sendResponse)(z,B,new Response(null,{status:500})),null}}e.s(["handler",()=>j,"patchFetch",()=>H,"routeModule",()=>N,"serverHooks",()=>$,"workAsyncStorage",()=>P,"workUnitAsyncStorage",()=>I],50873)}];
|
|
652
685
|
|
|
653
686
|
//# sourceMappingURL=b182f_next_dist_esm_build_templates_app-route_915c0243.js.map
|