@skspwork/config-doc 2.0.3 → 2.0.5
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 +3 -2
- package/packages/web/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/packages/web/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/packages/web/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/packages/web/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/packages/web/.next/standalone/.next/server/app/api/config/save/route.js +1 -1
- package/packages/web/.next/standalone/.next/server/app/api/config/save/route.js.nft.json +1 -1
- package/packages/web/.next/standalone/.next/server/app/api/export/route.js +3 -3
- package/packages/web/.next/standalone/.next/server/app/api/export/route.js.nft.json +1 -1
- package/packages/web/.next/standalone/.next/server/app/index.html +1 -1
- package/packages/web/.next/standalone/.next/server/app/index.rsc +3 -3
- package/packages/web/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/packages/web/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/packages/web/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/packages/web/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/packages/web/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__40e87302._.js +3 -0
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__93da9fce._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__c9655ac8._.js +3 -0
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__e19366f6._.js +1 -1
- package/packages/web/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_d09de205.js +368 -29
- package/packages/web/.next/standalone/.next/server/chunks/ssr/app_page_tsx_55b2e5ee._.js +1 -1
- package/packages/web/.next/standalone/.next/server/pages/404.html +1 -1
- package/packages/web/.next/standalone/.next/static/chunks/02de70e4c30afe2f.js +1 -0
- package/packages/web/.next/standalone/.next/static/chunks/862e384b52cfebf3.css +3 -0
- package/packages/web/.next/standalone/app/api/config/metadata/route.ts +5 -3
- package/packages/web/.next/standalone/package.json +2 -0
- package/packages/web/.next/standalone/playwright-report/index.html +1 -1
- package/packages/web/.next/static/chunks/02de70e4c30afe2f.js +1 -0
- package/packages/web/.next/static/chunks/862e384b52cfebf3.css +3 -0
- package/packages/web/package.json +2 -0
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__1a68b1f3._.js +0 -3
- package/packages/web/.next/standalone/.next/server/chunks/[root-of-the-server]__2c94dfea._.js +0 -3
- package/packages/web/.next/standalone/.next/static/chunks/4bbca8cd642026de.css +0 -3
- package/packages/web/.next/standalone/.next/static/chunks/54e2bd8f072e7d4e.js +0 -1
- package/packages/web/.next/standalone/app/api/config/load/route.ts +0 -57
- package/packages/web/.next/standalone/app/api/config/save/route.ts +0 -73
- package/packages/web/.next/standalone/app/api/export/route.ts +0 -75
- package/packages/web/.next/standalone/app/api/export/settings/route.ts +0 -144
- package/packages/web/.next/standalone/app/api/files/browse/route.ts +0 -46
- package/packages/web/.next/standalone/app/api/project/route.ts +0 -41
- package/packages/web/.next/standalone/app/globals.css +0 -26
- package/packages/web/.next/standalone/app/icon.svg +0 -41
- package/packages/web/.next/standalone/app/layout.tsx +0 -34
- package/packages/web/.next/standalone/app/page.tsx +0 -135
- package/packages/web/.next/standalone/components/ConfigFileTabs.tsx +0 -188
- package/packages/web/.next/standalone/components/ConfigTree.tsx +0 -176
- package/packages/web/.next/standalone/components/EditableList.tsx +0 -337
- package/packages/web/.next/standalone/components/ExportDialog.tsx +0 -234
- package/packages/web/.next/standalone/components/FieldsEditor.tsx +0 -92
- package/packages/web/.next/standalone/components/FileBrowser.tsx +0 -290
- package/packages/web/.next/standalone/components/Header.tsx +0 -37
- package/packages/web/.next/standalone/components/PropertyEditor.tsx +0 -102
- package/packages/web/.next/standalone/components/TagEditor.tsx +0 -86
- package/packages/web/.next/standalone/components/Toast.tsx +0 -91
- package/packages/web/.next/standalone/eslint.config.mjs +0 -18
- package/packages/web/.next/standalone/hooks/useConfigManager.ts +0 -633
- package/packages/web/.next/standalone/lib/configParser.ts +0 -155
- package/packages/web/.next/standalone/lib/fileSystem.ts +0 -186
- package/packages/web/.next/standalone/lib/getRootPath.ts +0 -45
- package/packages/web/.next/standalone/lib/htmlGenerator.ts +0 -839
- package/packages/web/.next/standalone/lib/jsonUtils.ts +0 -26
- package/packages/web/.next/standalone/lib/markdownGenerator.ts +0 -79
- package/packages/web/.next/standalone/lib/markdownTableGenerator.ts +0 -107
- package/packages/web/.next/standalone/lib/storage.ts +0 -104
- package/packages/web/.next/standalone/lib/utils.ts +0 -72
- package/packages/web/.next/standalone/next.config.ts +0 -10
- package/packages/web/.next/standalone/package-lock.json +0 -7977
- package/packages/web/.next/standalone/playwright.config.ts +0 -27
- package/packages/web/.next/standalone/postcss.config.mjs +0 -7
- package/packages/web/.next/standalone/test-results/.last-run.json +0 -4
- package/packages/web/.next/standalone/tsconfig.json +0 -34
- package/packages/web/.next/standalone/tsconfig.tsbuildinfo +0 -1
- package/packages/web/.next/standalone/types/index.ts +0 -74
- package/packages/web/.next/standalone/vitest.config.ts +0 -14
- package/packages/web/.next/static/chunks/4bbca8cd642026de.css +0 -3
- package/packages/web/.next/static/chunks/54e2bd8f072e7d4e.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports=[47482,e=>{"use strict";var t=e.i(47909),
|
|
1
|
+
module.exports=[47482,e=>{"use strict";var t=e.i(47909),a=e.i(74017),r=e.i(96250),n=e.i(59756),i=e.i(61916),o=e.i(74677),s=e.i(69741),l=e.i(16795),c=e.i(87718),d=e.i(95169),p=e.i(47587),f=e.i(66012),h=e.i(70101),u=e.i(26937),g=e.i(10372),m=e.i(93695);e.i(52474);var y=e.i(220),b=e.i(89171),P=e.i(27637),v=e.i(21127);function x(e){return e.replace(/\|/g,"\\|").replace(/\n/g,"<br>").replace(/\r/g,"")}function w(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function C(e,t){let a=t.split(/(?=\[)|:/),r=e;for(let e of a){if(null==r)return;if(e.startsWith("[")&&e.endsWith("]")){let t=parseInt(e.slice(1,-1),10);if(!Array.isArray(r))return;r=r[t]}else if(e&&"object"==typeof r&&e in r)r=r[e];else if(e)return}return r}class D{fsService;storageService;constructor(e){this.fsService=new P.FileSystemService(e),this.storageService=new v.StorageService(this.fsService)}async generateHtml(){let e=await this.fsService.loadProjectSettings();if(!e||!e.configFiles||0===e.configFiles.length)return this.generateEmptyHtml();let t=e.fields?Object.keys(e.fields):[],a=e.availableTags||[],r=[];for(let t of e.configFiles)try{let e=t.split(/[/\\]/).pop()||"config.json",a=this.storageService.getDocsFileName(t),n=await this.fsService.loadConfigFile(t),i=await this.fsService.loadConfigDocs(a);r.push({filePath:t,fileName:e,configData:n,docs:i||{configFilePath:t,lastModified:new Date().toISOString(),properties:{}}})}catch(e){console.error(`Failed to load config: ${t}`,e)}let n={projectName:e.projectName,createdAt:"",lastModified:new Date().toISOString(),configFiles:[]};return this.generateFullHtml(n,r,t,a,e.associativeArrays||[])}generateEmptyHtml(){return`<!DOCTYPE html>
|
|
2
2
|
<html lang="ja">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
@@ -17,19 +17,19 @@ module.exports=[47482,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250
|
|
|
17
17
|
</main>
|
|
18
18
|
</div>
|
|
19
19
|
</body>
|
|
20
|
-
</html>`}generateFullHtml(e,t){let
|
|
20
|
+
</html>`}generateFullHtml(e,t,a,r,n){let i=JSON.stringify(t,null,2),o=JSON.stringify(a),s=JSON.stringify(r),l=JSON.stringify(n);return`<!DOCTYPE html>
|
|
21
21
|
<html lang="ja">
|
|
22
22
|
<head>
|
|
23
23
|
<meta charset="UTF-8">
|
|
24
24
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
25
|
-
<title>${
|
|
25
|
+
<title>${w(e.projectName)} - ConfigDoc</title>
|
|
26
26
|
${this.getStyles()}
|
|
27
27
|
</head>
|
|
28
28
|
<body>
|
|
29
29
|
<div class="container">
|
|
30
30
|
<header>
|
|
31
31
|
<div class="header-content">
|
|
32
|
-
<h1>${
|
|
32
|
+
<h1>${w(e.projectName)}</h1>
|
|
33
33
|
<p class="meta">最終更新: ${new Date(e.lastModified).toLocaleString("ja-JP")}</p>
|
|
34
34
|
</div>
|
|
35
35
|
</header>
|
|
@@ -51,11 +51,312 @@ module.exports=[47482,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250
|
|
|
51
51
|
</div>
|
|
52
52
|
|
|
53
53
|
<script>
|
|
54
|
-
const configs = ${
|
|
54
|
+
const configs = ${i};
|
|
55
|
+
const fieldKeys = ${o};
|
|
56
|
+
const availableTags = ${s};
|
|
57
|
+
const associativeArrays = ${l};
|
|
55
58
|
let activeConfigIndex = 0;
|
|
56
59
|
let selectedPath = '';
|
|
57
60
|
let currentSearchQuery = '';
|
|
58
61
|
|
|
62
|
+
// タグをavailableTagsの順序でソート
|
|
63
|
+
function sortTagsByOrder(tags) {
|
|
64
|
+
if (!tags || tags.length === 0) return [];
|
|
65
|
+
return [...tags].sort((a, b) => {
|
|
66
|
+
const indexA = availableTags.indexOf(a);
|
|
67
|
+
const indexB = availableTags.indexOf(b);
|
|
68
|
+
if (indexA !== -1 && indexB !== -1) return indexA - indexB;
|
|
69
|
+
if (indexA === -1) return 1;
|
|
70
|
+
if (indexB === -1) return -1;
|
|
71
|
+
return 0;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// テンプレートパスに変換(配列インデックスをワイルドカードに)
|
|
76
|
+
function normalizeToTemplatePath(path) {
|
|
77
|
+
return path.replace(/\\[\\d+\\]/g, '[*]');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// テンプレートパスにマッチするか判定
|
|
81
|
+
function matchesTemplatePath(concretePath, templatePath) {
|
|
82
|
+
const regexPattern = templatePath
|
|
83
|
+
.replace(/[.*+?^\${}()|[\\]\\\\]/g, '\\\\$&')
|
|
84
|
+
.replace(/\\\\\\[\\\\\\*\\\\\\]/g, '\\\\[\\\\d+\\\\]');
|
|
85
|
+
const regex = new RegExp('^' + regexPattern + '$');
|
|
86
|
+
return regex.test(concretePath);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// パスから値を取得するヘルパー関数
|
|
90
|
+
function getValueByPath(obj, path) {
|
|
91
|
+
if (!path || !obj) return obj;
|
|
92
|
+
const keys = path.split(/(?=\\[)|:/);
|
|
93
|
+
let value = obj;
|
|
94
|
+
for (const key of keys) {
|
|
95
|
+
if (value === undefined || value === null) return undefined;
|
|
96
|
+
if (key.startsWith('[') && key.endsWith(']')) {
|
|
97
|
+
const index = parseInt(key.slice(1, -1), 10);
|
|
98
|
+
if (Array.isArray(value)) {
|
|
99
|
+
value = value[index];
|
|
100
|
+
} else {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
} else if (key && typeof value === 'object' && key in value) {
|
|
104
|
+
value = value[key];
|
|
105
|
+
} else if (key) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// マッチング用にbasePathを正規化するヘルパー関数
|
|
113
|
+
function normalizeBasePathForMatching(basePath, mappings, configData) {
|
|
114
|
+
for (const mapping of mappings) {
|
|
115
|
+
if (basePath.startsWith(mapping.basePath + ':') && mapping.basePath !== basePath) {
|
|
116
|
+
const remainder = basePath.substring(mapping.basePath.length + 1);
|
|
117
|
+
const parts = remainder.split(':');
|
|
118
|
+
const keyName = parts[0];
|
|
119
|
+
const parentObj = getValueByPath(configData, mapping.basePath);
|
|
120
|
+
if (parentObj && typeof parentObj === 'object' && !Array.isArray(parentObj)) {
|
|
121
|
+
const keys = Object.keys(parentObj);
|
|
122
|
+
const keyIndex = keys.indexOf(keyName);
|
|
123
|
+
if (keyIndex >= 0) {
|
|
124
|
+
const restOfBasePath = parts.slice(1).join(':');
|
|
125
|
+
const partiallyNormalized = mapping.basePath + '[' + keyIndex + ']' + (restOfBasePath ? ':' + restOfBasePath : '');
|
|
126
|
+
return normalizeBasePathForMatching(partiallyNormalized, mappings, configData);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return basePath;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ワイルドカード付きマッピングを適用するヘルパー関数
|
|
135
|
+
function applyWildcardMapping(path, wildcardBasePath, configData) {
|
|
136
|
+
const patternParts = wildcardBasePath.split(':');
|
|
137
|
+
const pathParts = path.split(':');
|
|
138
|
+
const extractedKeys = [];
|
|
139
|
+
|
|
140
|
+
let pathIdx = 0;
|
|
141
|
+
let configPath = '';
|
|
142
|
+
|
|
143
|
+
for (const wPart of patternParts) {
|
|
144
|
+
if (wPart.endsWith('[*]')) {
|
|
145
|
+
const baseKey = wPart.slice(0, -3);
|
|
146
|
+
if (pathParts[pathIdx] === baseKey) {
|
|
147
|
+
configPath = configPath ? configPath + ':' + baseKey : baseKey;
|
|
148
|
+
pathIdx++;
|
|
149
|
+
if (pathIdx < pathParts.length) {
|
|
150
|
+
extractedKeys.push({ key: pathParts[pathIdx], configPath });
|
|
151
|
+
pathIdx++;
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
return path;
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
if (pathParts[pathIdx] === wPart) {
|
|
158
|
+
configPath = configPath ? configPath + ':' + wPart : wPart;
|
|
159
|
+
pathIdx++;
|
|
160
|
+
} else {
|
|
161
|
+
return path;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const remainder = pathIdx < pathParts.length ? pathParts.slice(pathIdx).join(':') : '';
|
|
167
|
+
|
|
168
|
+
let resultPath = '';
|
|
169
|
+
let currentConfigPath = '';
|
|
170
|
+
|
|
171
|
+
for (const wPart of patternParts) {
|
|
172
|
+
if (wPart.endsWith('[*]')) {
|
|
173
|
+
const baseKey = wPart.slice(0, -3);
|
|
174
|
+
currentConfigPath = currentConfigPath ? currentConfigPath + ':' + baseKey : baseKey;
|
|
175
|
+
|
|
176
|
+
const keyInfo = extractedKeys.find(k => k.configPath === currentConfigPath);
|
|
177
|
+
if (keyInfo) {
|
|
178
|
+
const associativeObj = getValueByPath(configData, currentConfigPath);
|
|
179
|
+
if (associativeObj && typeof associativeObj === 'object' && !Array.isArray(associativeObj)) {
|
|
180
|
+
const keys = Object.keys(associativeObj);
|
|
181
|
+
const keyIndex = keys.indexOf(keyInfo.key);
|
|
182
|
+
if (keyIndex >= 0) {
|
|
183
|
+
resultPath = resultPath ? resultPath + ':' + baseKey + '[' + keyIndex + ']' : baseKey + '[' + keyIndex + ']';
|
|
184
|
+
currentConfigPath = currentConfigPath + ':' + keyInfo.key;
|
|
185
|
+
} else {
|
|
186
|
+
return path;
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
return path;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
resultPath = resultPath ? resultPath + ':' + wPart : wPart;
|
|
194
|
+
currentConfigPath = currentConfigPath ? currentConfigPath + ':' + wPart : wPart;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (remainder) {
|
|
199
|
+
const remainderParts = remainder.split(':');
|
|
200
|
+
const firstKey = remainderParts[0];
|
|
201
|
+
|
|
202
|
+
const lastAssocObj = getValueByPath(configData, currentConfigPath);
|
|
203
|
+
if (lastAssocObj && typeof lastAssocObj === 'object' && !Array.isArray(lastAssocObj)) {
|
|
204
|
+
const keys = Object.keys(lastAssocObj);
|
|
205
|
+
const keyIndex = keys.indexOf(firstKey);
|
|
206
|
+
if (keyIndex >= 0) {
|
|
207
|
+
resultPath = resultPath + '[' + keyIndex + ']';
|
|
208
|
+
if (remainderParts.length > 1) {
|
|
209
|
+
resultPath = resultPath + ':' + remainderParts.slice(1).join(':');
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
resultPath = resultPath + ':' + remainder;
|
|
213
|
+
}
|
|
214
|
+
} else {
|
|
215
|
+
resultPath = resultPath + ':' + remainder;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return resultPath;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// 連想配列パスを正規化(キー名を配列インデックスに変換)- 再帰的に処理
|
|
223
|
+
// ワイルドカード付きマッピングにも対応
|
|
224
|
+
function normalizeAssociativeArrayPath(path, mappings, configData) {
|
|
225
|
+
const sortedMappings = [...mappings].sort((a, b) => b.basePath.length - a.basePath.length);
|
|
226
|
+
let normalizedPath = path;
|
|
227
|
+
let changed = true;
|
|
228
|
+
|
|
229
|
+
while (changed) {
|
|
230
|
+
changed = false;
|
|
231
|
+
for (const mapping of sortedMappings) {
|
|
232
|
+
const basePath = mapping.basePath;
|
|
233
|
+
|
|
234
|
+
// ワイルドカード付きマッピングの場合
|
|
235
|
+
if (basePath.includes('[*]')) {
|
|
236
|
+
const result = applyWildcardMapping(normalizedPath, basePath, configData);
|
|
237
|
+
if (result !== normalizedPath) {
|
|
238
|
+
normalizedPath = result;
|
|
239
|
+
changed = true;
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const normalizedBasePath = normalizeBasePathForMatching(basePath, sortedMappings, configData);
|
|
246
|
+
|
|
247
|
+
if (normalizedPath.startsWith(normalizedBasePath + ':')) {
|
|
248
|
+
const remainder = normalizedPath.substring(normalizedBasePath.length + 1);
|
|
249
|
+
const parts = remainder.split(':');
|
|
250
|
+
const keyName = parts[0];
|
|
251
|
+
|
|
252
|
+
if (keyName.match(/^[d+]$/)) {
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const associativeObj = getValueByPath(configData, basePath);
|
|
257
|
+
if (associativeObj && typeof associativeObj === 'object' && !Array.isArray(associativeObj)) {
|
|
258
|
+
const keys = Object.keys(associativeObj);
|
|
259
|
+
const keyIndex = keys.indexOf(keyName);
|
|
260
|
+
if (keyIndex >= 0) {
|
|
261
|
+
const restOfPath = parts.slice(1).join(':');
|
|
262
|
+
normalizedPath = normalizedBasePath + '[' + keyIndex + ']' + (restOfPath ? ':' + restOfPath : '');
|
|
263
|
+
changed = true;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return normalizedPath;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// 具体的なパスからテンプレートパスを取得(連想配列も考慮)
|
|
274
|
+
function getTemplatePathForConcrete(concretePath, mappings, configData) {
|
|
275
|
+
let path = concretePath;
|
|
276
|
+
if (configData) {
|
|
277
|
+
path = normalizeAssociativeArrayPath(path, mappings, configData);
|
|
278
|
+
}
|
|
279
|
+
return normalizeToTemplatePath(path);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// ドキュメントを検索(テンプレートフォールバック付き)
|
|
283
|
+
function findDocumentationForPath(propertyPath, docsProperties, configData) {
|
|
284
|
+
// 1. 直接ルックアップ
|
|
285
|
+
if (docsProperties[propertyPath]) {
|
|
286
|
+
return docsProperties[propertyPath];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// 2. テンプレートパスでフォールバック検索(連想配列も考慮)
|
|
290
|
+
const templatePath = getTemplatePathForConcrete(propertyPath, associativeArrays, configData);
|
|
291
|
+
if (templatePath !== propertyPath && docsProperties[templatePath]) {
|
|
292
|
+
const doc = docsProperties[templatePath];
|
|
293
|
+
if (doc.isTemplate) {
|
|
294
|
+
return doc;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// 3. すべてのテンプレートドキュメントを検索
|
|
299
|
+
for (const [docPath, doc] of Object.entries(docsProperties)) {
|
|
300
|
+
if (doc.isTemplate && matchesTemplatePath(propertyPath, docPath)) {
|
|
301
|
+
return doc;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// テンプレートドキュメントのみを検索(連想配列も考慮)
|
|
309
|
+
function findTemplateForPath(propertyPath, docsProperties, configData) {
|
|
310
|
+
const templatePath = getTemplatePathForConcrete(propertyPath, associativeArrays, configData);
|
|
311
|
+
if (templatePath !== propertyPath && docsProperties[templatePath]) {
|
|
312
|
+
const doc = docsProperties[templatePath];
|
|
313
|
+
if (doc.isTemplate) {
|
|
314
|
+
return doc;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
for (const [docPath, doc] of Object.entries(docsProperties)) {
|
|
319
|
+
if (doc.isTemplate && matchesTemplatePath(propertyPath, docPath)) {
|
|
320
|
+
return doc;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// ドキュメントを検索してマージ(直接ドキュメントの空フィールドをテンプレートで補完)
|
|
328
|
+
function findAndMergeDocumentation(propertyPath, docsProperties, configData) {
|
|
329
|
+
const directDoc = docsProperties[propertyPath];
|
|
330
|
+
const templateDoc = findTemplateForPath(propertyPath, docsProperties, configData);
|
|
331
|
+
|
|
332
|
+
if (!directDoc && !templateDoc) return null;
|
|
333
|
+
if (directDoc && !templateDoc) return directDoc;
|
|
334
|
+
if (!directDoc && templateDoc) return templateDoc;
|
|
335
|
+
|
|
336
|
+
// 両方ある場合:マージ
|
|
337
|
+
const mergedDoc = { ...directDoc };
|
|
338
|
+
|
|
339
|
+
// タグのマージ
|
|
340
|
+
if ((!directDoc.tags || directDoc.tags.length === 0) && templateDoc.tags && templateDoc.tags.length > 0) {
|
|
341
|
+
mergedDoc.tags = templateDoc.tags;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// フィールドのマージ
|
|
345
|
+
if (templateDoc.fields) {
|
|
346
|
+
const mergedFields = { ...(directDoc.fields || {}) };
|
|
347
|
+
for (const [key, value] of Object.entries(templateDoc.fields)) {
|
|
348
|
+
if (!mergedFields[key] || mergedFields[key].trim() === '') {
|
|
349
|
+
if (value && value.trim() !== '') {
|
|
350
|
+
mergedFields[key] = value;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
mergedDoc.fields = mergedFields;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return mergedDoc;
|
|
358
|
+
}
|
|
359
|
+
|
|
59
360
|
${this.getScripts()}
|
|
60
361
|
</script>
|
|
61
362
|
</body>
|
|
@@ -398,13 +699,13 @@ module.exports=[47482,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250
|
|
|
398
699
|
}
|
|
399
700
|
</style>`}getScripts(){return`
|
|
400
701
|
// ツリー構造を構築
|
|
401
|
-
function buildTree(obj, path = '', docs = {}) {
|
|
702
|
+
function buildTree(obj, path = '', docs = {}, configData = null) {
|
|
402
703
|
const tree = [];
|
|
403
704
|
|
|
404
705
|
for (const key in obj) {
|
|
405
706
|
const currentPath = path ? \`\${path}:\${key}\` : key;
|
|
406
707
|
const value = obj[key];
|
|
407
|
-
const hasDoc = docs.properties && docs.properties
|
|
708
|
+
const hasDoc = docs.properties && findDocumentationForPath(currentPath, docs.properties, configData);
|
|
408
709
|
|
|
409
710
|
if (typeof value === 'object' && value !== null) {
|
|
410
711
|
if (Array.isArray(value)) {
|
|
@@ -422,8 +723,8 @@ module.exports=[47482,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250
|
|
|
422
723
|
path: elementPath,
|
|
423
724
|
value: item,
|
|
424
725
|
hasChildren: true,
|
|
425
|
-
hasDoc: !!(docs.properties && docs.properties
|
|
426
|
-
children: buildTree(item, elementPath, docs)
|
|
726
|
+
hasDoc: !!(docs.properties && findDocumentationForPath(elementPath, docs.properties, configData)),
|
|
727
|
+
children: buildTree(item, elementPath, docs, configData)
|
|
427
728
|
});
|
|
428
729
|
}
|
|
429
730
|
});
|
|
@@ -454,7 +755,7 @@ module.exports=[47482,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250
|
|
|
454
755
|
value: value,
|
|
455
756
|
hasChildren: true,
|
|
456
757
|
hasDoc: !!hasDoc,
|
|
457
|
-
children: buildTree(value, currentPath, docs)
|
|
758
|
+
children: buildTree(value, currentPath, docs, configData)
|
|
458
759
|
});
|
|
459
760
|
}
|
|
460
761
|
} else {
|
|
@@ -537,7 +838,7 @@ module.exports=[47482,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250
|
|
|
537
838
|
function showPropertyDetail(node) {
|
|
538
839
|
const detailEl = document.getElementById('propertyDetail');
|
|
539
840
|
const config = configs[activeConfigIndex];
|
|
540
|
-
const doc = config.docs.properties
|
|
841
|
+
const doc = config.docs.properties ? findAndMergeDocumentation(node.path, config.docs.properties, config.configData) : null;
|
|
541
842
|
|
|
542
843
|
let html = \`<h2>\${escapeHtml(node.key)}</h2>\`;
|
|
543
844
|
html += \`<div class="property-file" title="\${escapeHtml(config.filePath)}">ファイル: \${escapeHtml(config.filePath)}</div>\`;
|
|
@@ -546,18 +847,20 @@ module.exports=[47482,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250
|
|
|
546
847
|
|
|
547
848
|
if (doc) {
|
|
548
849
|
if (doc.tags && doc.tags.length > 0) {
|
|
850
|
+
const sortedTags = sortTagsByOrder(doc.tags);
|
|
549
851
|
html += \`<div class="doc-section">
|
|
550
852
|
<h3>タグ</h3>
|
|
551
853
|
<div class="tag-list">\`;
|
|
552
|
-
|
|
854
|
+
sortedTags.forEach(tag => {
|
|
553
855
|
html += \`<span class="tag">\${escapeHtml(tag)}</span>\`;
|
|
554
856
|
});
|
|
555
857
|
html += \`</div>
|
|
556
858
|
</div>\`;
|
|
557
859
|
}
|
|
558
860
|
|
|
559
|
-
//
|
|
560
|
-
|
|
861
|
+
// フィールドをprojectFieldsの順序で表示
|
|
862
|
+
fieldKeys.forEach(label => {
|
|
863
|
+
const value = doc.fields[label];
|
|
561
864
|
if (value) {
|
|
562
865
|
html += \`<div class="doc-section">
|
|
563
866
|
<h3>\${escapeHtml(label)}</h3>
|
|
@@ -625,7 +928,7 @@ module.exports=[47482,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250
|
|
|
625
928
|
treeEl.innerHTML = '';
|
|
626
929
|
|
|
627
930
|
const config = configs[activeConfigIndex];
|
|
628
|
-
const tree = buildTree(config.configData, '', config.docs);
|
|
931
|
+
const tree = buildTree(config.configData, '', config.docs, config.configData);
|
|
629
932
|
renderTree(tree, treeEl);
|
|
630
933
|
}
|
|
631
934
|
|
|
@@ -690,7 +993,7 @@ module.exports=[47482,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250
|
|
|
690
993
|
// 全設定ファイルから検索してマッチした項目を収集
|
|
691
994
|
let foundInConfigs = [];
|
|
692
995
|
configs.forEach((config, index) => {
|
|
693
|
-
const tree = buildTree(config.configData, '', config.docs);
|
|
996
|
+
const tree = buildTree(config.configData, '', config.docs, config.configData);
|
|
694
997
|
const hasMatch = searchInTreeForConfig(tree, query, config);
|
|
695
998
|
if (hasMatch) {
|
|
696
999
|
foundInConfigs.push(index);
|
|
@@ -755,38 +1058,74 @@ module.exports=[47482,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250
|
|
|
755
1058
|
renderCurrentConfig();
|
|
756
1059
|
setupSearch();
|
|
757
1060
|
}
|
|
758
|
-
`}}class
|
|
1061
|
+
`}}class j{static flattenConfig(e,t=""){let a={};for(let r in e){let n=t?`${t}:${r}`:r,i=e[r];i&&"object"==typeof i?Array.isArray(i)?i.some(e=>e&&"object"==typeof e&&!Array.isArray(e))?i.forEach((e,t)=>{e&&"object"==typeof e&&!Array.isArray(e)&&Object.assign(a,this.flattenConfig(e,`${n}[${t}]`))}):a[n]=i:Object.assign(a,this.flattenConfig(i,n)):a[n]=i}return a}static getAllPropertyPaths(e,t=""){let a=[];for(let r in e){let n=t?`${t}:${r}`:r,i=e[r];a.push(n),i&&"object"==typeof i&&(Array.isArray(i)?i.some(e=>e&&"object"==typeof e&&!Array.isArray(e))&&i.forEach((e,t)=>{if(e&&"object"==typeof e&&!Array.isArray(e)){let r=`${n}[${t}]`;a.push(r),a.push(...this.getAllPropertyPaths(e,r))}}):a.push(...this.getAllPropertyPaths(i,n)))}return a}static buildTree(e,t=""){let a=[];for(let r in e){let n=t?`${t}:${r}`:r,i=e[r];if(i&&"object"==typeof i)if(Array.isArray(i))if(i.some(e=>e&&"object"==typeof e&&!Array.isArray(e))){let e=[];i.forEach((t,a)=>{t&&"object"==typeof t&&!Array.isArray(t)&&e.push({key:`[${a}]`,fullPath:`${n}[${a}]`,value:t,children:this.buildTree(t,`${n}[${a}]`),hasDocumentation:!1,type:"object"})}),a.push({key:r,fullPath:n,value:i,children:e.length>0?e:void 0,hasDocumentation:!1,type:"array"})}else a.push({key:r,fullPath:n,value:i,hasDocumentation:!1,type:"array"});else a.push({key:r,fullPath:n,value:i,children:this.buildTree(i,n),hasDocumentation:!1,type:"object"});else a.push({key:r,fullPath:n,value:i,hasDocumentation:!1,type:typeof i})}return a}}function k(e,t){return[...e].sort((e,a)=>{let r=t.indexOf(e),n=t.indexOf(a);return -1!==r&&-1!==n?r-n:-1===r?1:-1===n?-1:0})}var A=e.i(61958);class ${rootPath;constructor(e){this.rootPath=e}async generateMarkdownForFile(e){let t=new P.FileSystemService(this.rootPath),a=new v.StorageService(t),r=await t.loadProjectSettings(),n=r?.fields?Object.keys(r.fields):[],i=r?.availableTags||[],o=r?.associativeArrays||[],s=e.split(/[/\\]/).pop()||"config.json",l=await a.loadAllDocs(e),c=await t.loadConfigFile(e),d=`# ${s}
|
|
1062
|
+
|
|
1063
|
+
`;d+=`**ファイルパス:** \`${e}\`
|
|
759
1064
|
|
|
760
1065
|
最終更新: ${new Date().toLocaleString("ja-JP")}
|
|
761
1066
|
|
|
762
1067
|
---
|
|
763
1068
|
|
|
764
|
-
|
|
1069
|
+
`;let p=j.getAllPropertyPaths(c);if(0===p.length)d+="*プロパティがありません。*\n\n";else for(let e of(d+="## プロパティ一覧\n\n",p)){let t=(0,A.findAndMergeDocumentation)(e,l.properties,o,c),a=C(c,e);if(d+=`### \`${e}\`
|
|
765
1070
|
|
|
766
|
-
|
|
1071
|
+
`,null!=a){let e=typeof a,t=Array.isArray(a),r="object"===e&&!t;t?a.length>0&&a.every(e=>"object"!=typeof e||null===e)&&(d+=`**値:** \`${JSON.stringify(a)}\`
|
|
767
1072
|
|
|
768
|
-
|
|
1073
|
+
`):r||(d+=`**値:** \`${String(a)}\`
|
|
769
1074
|
|
|
770
|
-
|
|
1075
|
+
`)}if(t){if(t.tags&&t.tags.length>0){let e=k(t.tags,i);d+=`**タグ:** ${e.map(e=>`\`${e}\``).join(", ")}
|
|
771
1076
|
|
|
772
|
-
`
|
|
1077
|
+
`}if(t.fields)for(let e of n){let a=t.fields[e];a&&(d+=`**${e}:**
|
|
1078
|
+
|
|
1079
|
+
${a}
|
|
1080
|
+
|
|
1081
|
+
`)}}else d+="*ドキュメントなし*\n\n";d+="---\n\n"}return d+`
|
|
1082
|
+
*このドキュメントは ConfigDoc により自動生成されました。*
|
|
1083
|
+
`}async generateMarkdown(){let e=new P.FileSystemService(this.rootPath),t=new v.StorageService(e),a=await e.loadProjectSettings();if(!a||0===a.configFiles.length)return"# 設定ファイルドキュメント\n\nドキュメント化された設定ファイルがありません。\n";let r=a.fields?Object.keys(a.fields):[],n=a.availableTags||[],i="# 設定ファイルドキュメント\n\n";for(let o of(i+=`プロジェクト: **${a.projectName}**
|
|
1084
|
+
|
|
1085
|
+
最終更新: ${new Date().toLocaleString("ja-JP")}
|
|
1086
|
+
|
|
1087
|
+
---
|
|
773
1088
|
|
|
774
|
-
${
|
|
1089
|
+
`,a.configFiles)){let s=o.split(/[/\\]/).pop()||"config.json",l=await t.loadAllDocs(o),c=await e.loadConfigFile(o);i+=`## ${s}
|
|
1090
|
+
|
|
1091
|
+
**ファイルパス:** \`${o}\`
|
|
1092
|
+
|
|
1093
|
+
`;let d=j.getAllPropertyPaths(c);if(0===d.length){i+="*プロパティがありません。*\n\n";continue}i+="### プロパティ一覧\n\n";let p=a.associativeArrays||[];for(let e of d){let t=(0,A.findAndMergeDocumentation)(e,l.properties,p,c),a=C(c,e);if(i+=`#### \`${e}\`
|
|
1094
|
+
|
|
1095
|
+
`,null!=a){let e=typeof a,t=Array.isArray(a),r="object"===e&&!t;t?a.length>0&&a.every(e=>"object"!=typeof e||null===e)&&(i+=`**値:** \`${JSON.stringify(a)}\`
|
|
1096
|
+
|
|
1097
|
+
`):r||(i+=`**値:** \`${String(a)}\`
|
|
1098
|
+
|
|
1099
|
+
`)}if(t){if(t.tags&&t.tags.length>0){let e=k(t.tags,n);i+=`**タグ:** ${e.map(e=>`\`${e}\``).join(", ")}
|
|
1100
|
+
|
|
1101
|
+
`}if(t.fields)for(let e of r){let a=t.fields[e];a&&(i+=`**${e}:**
|
|
1102
|
+
|
|
1103
|
+
${a}
|
|
1104
|
+
|
|
1105
|
+
`)}}else i+="*ドキュメントなし*\n\n";i+="---\n\n"}}return i+`
|
|
1106
|
+
*このドキュメントは ConfigDoc により自動生成されました。*
|
|
1107
|
+
`}}class S{rootPath;constructor(e){this.rootPath=e}async generateMarkdownTableForFile(e){let t=new P.FileSystemService(this.rootPath),a=new v.StorageService(t),r=await t.loadProjectSettings(),n=r?.fields?Object.keys(r.fields):[],i=r?.availableTags||[],o=r?.associativeArrays||[],s=e.split(/[/\\]/).pop()||"config.json",l=await a.loadAllDocs(e),c=await t.loadConfigFile(e),d=`# ${s}
|
|
1108
|
+
|
|
1109
|
+
`;d+=`**ファイルパス:** \`${e}\`
|
|
1110
|
+
|
|
1111
|
+
最終更新: ${new Date().toLocaleString("ja-JP")}
|
|
1112
|
+
|
|
1113
|
+
---
|
|
775
1114
|
|
|
776
|
-
|
|
1115
|
+
`;let p=j.getAllPropertyPaths(c);if(0===p.length)d+="*プロパティがありません。*\n\n";else{for(let e of(d+="| プロパティ名 | タグ | 値 |",n.forEach(e=>{d+=` ${e} |`}),d+="\n|-------------|------|-----|",n.forEach(()=>{d+="------|"}),d+="\n",p)){let t=(0,A.findAndMergeDocumentation)(e,l.properties,o,c),a=x(e),r=t&&t.tags&&t.tags.length>0?k(t.tags,i):[],s=r.length>0?x(r.map(e=>`\`${e}\``).join(", ")):"-",p=x(this.getPropertyValue(c,e));d+=`| ${a} | ${s} | ${p} |`,n.forEach(e=>{let a=t&&t.fields&&t.fields[e]||"-";d+=` ${x(a)} |`}),d+="\n"}d+="\n"}return d+=`
|
|
777
1116
|
*このドキュメントは ConfigDoc により自動生成されました。*
|
|
778
|
-
`}
|
|
1117
|
+
`}async generateMarkdownTable(){let e=new P.FileSystemService(this.rootPath),t=new v.StorageService(e),a=await e.loadProjectSettings();if(!a||0===a.configFiles.length)return"# 設定ファイルドキュメント\n\nドキュメント化された設定ファイルがありません。\n";let r=a.fields?Object.keys(a.fields):[],n=a.availableTags||[],i="# 設定ファイルドキュメント\n\n";for(let o of(i+=`プロジェクト: **${a.projectName}**
|
|
779
1118
|
|
|
780
1119
|
最終更新: ${new Date().toLocaleString("ja-JP")}
|
|
781
1120
|
|
|
782
1121
|
---
|
|
783
1122
|
|
|
784
|
-
`,
|
|
1123
|
+
`,a.configFiles)){let s=o.split(/[/\\]/).pop()||"config.json",l=await t.loadAllDocs(o),c=await e.loadConfigFile(o);i+=`## ${s}
|
|
785
1124
|
|
|
786
|
-
**ファイルパス:** \`${
|
|
1125
|
+
**ファイルパス:** \`${o}\`
|
|
787
1126
|
|
|
788
|
-
`;let
|
|
1127
|
+
`;let d=j.getAllPropertyPaths(c);if(0===d.length){i+="*プロパティがありません。*\n\n";continue}i+="| プロパティ名 | タグ | 値 |",r.forEach(e=>{i+=` ${e} |`}),i+="\n|-------------|------|-----|",r.forEach(()=>{i+="------|"}),i+="\n";let p=a.associativeArrays||[];for(let e of d){let t=(0,A.findAndMergeDocumentation)(e,l.properties,p,c),a=x(e),o=t&&t.tags&&t.tags.length>0?k(t.tags,n):[],s=o.length>0?x(o.map(e=>`\`${e}\``).join(", ")):"-",d=x(this.getPropertyValue(c,e));i+=`| ${a} | ${s} | ${d} |`,r.forEach(e=>{let a=t&&t.fields&&t.fields[e]||"-";i+=` ${x(a)} |`}),i+="\n"}i+="\n"}return i+=`
|
|
789
1128
|
*このドキュメントは ConfigDoc により自動生成されました。*
|
|
790
|
-
`}getPropertyValue(e,t){var
|
|
1129
|
+
`}getPropertyValue(e,t){var a=C(e,t);if(null==a)return"-";let r=typeof a,n=Array.isArray(a);return n?a.length>0&&a.every(e=>"object"!=typeof e||null===e)?JSON.stringify(a):"-":"object"!==r||n?String(a):"-"}}var E=e.i(10720),T=e.i(14747),O=e.i(24868);async function I(e){try{let t,a=(0,E.getRootPath)();try{t=await e.json()}catch{t={}}let{format:r="html"}=t,n=t.fileName?.trim()||"config-doc",i=t.outputDir?.trim()||"",o=new P.FileSystemService(a);await o.ensureConfigDocDir();let s=i?T.default.join(a,i):a;if(await O.default.mkdir(s,{recursive:!0}),"markdown"===r){let e=await o.loadProjectSettings();if(!e||0===e.configFiles.length)return b.NextResponse.json({success:!1,error:"ドキュメント化された設定ファイルがありません"},{status:400});let t=new $(a),r=[];for(let a of e.configFiles){let e=(a.split(/[/\\]/).pop()||"config.json").replace(/\.json$/i,".md"),n=T.default.join(s,e),i=await t.generateMarkdownForFile(a);await O.default.writeFile(n,i,"utf-8"),r.push(n)}return b.NextResponse.json({success:!0,message:`Markdownファイルを${r.length}件生成しました`,outputPaths:r})}if("markdown-table"===r){let e=await o.loadProjectSettings();if(!e||0===e.configFiles.length)return b.NextResponse.json({success:!1,error:"ドキュメント化された設定ファイルがありません"},{status:400});let t=new S(a),r=[];for(let a of e.configFiles){let e=(a.split(/[/\\]/).pop()||"config.json").replace(/\.json$/i,".md"),n=T.default.join(s,e),i=await t.generateMarkdownTableForFile(a);await O.default.writeFile(n,i,"utf-8"),r.push(n)}return b.NextResponse.json({success:!0,message:`Markdownテーブルファイルを${r.length}件生成しました`,outputPaths:r})}let l=new D(a),c=await l.generateHtml(),d=`${n}.html`,p=T.default.join(s,d);return await O.default.writeFile(p,c,"utf-8"),b.NextResponse.json({success:!0,message:"HTMLファイルを生成しました",outputPath:p})}catch(e){return console.error("API Error:",e),b.NextResponse.json({success:!1,error:e instanceof Error?e.message:"Unknown error"},{status:500})}}e.s(["POST",()=>I],49588);var F=e.i(49588);let N=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/export/route",pathname:"/api/export",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/export/route.ts",nextConfigOutput:"standalone",userland:F}),{workAsyncStorage:R,workUnitAsyncStorage:M,serverHooks:H}=N;function z(){return(0,r.patchFetch)({workAsyncStorage:R,workUnitAsyncStorage:M})}async function L(e,t,r){N.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let b="/api/export/route";b=b.replace(/\/index$/,"")||"/";let P=await N.prepare(e,t,{srcPage:b,multiZoneDraftMode:!1});if(!P)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:v,params:x,nextConfig:w,parsedUrl:C,isDraftMode:D,prerenderManifest:j,routerServerContext:k,isOnDemandRevalidate:A,revalidateOnlyGenerated:$,resolvedPathname:S,clientReferenceManifest:E,serverActionsManifest:T}=P,O=(0,s.normalizeAppPath)(b),I=!!(j.dynamicRoutes[O]||j.routes[S]),F=async()=>((null==k?void 0:k.render404)?await k.render404(e,t,C,!1):t.end("This page could not be found"),null);if(I&&!D){let e=!!j.routes[S],t=j.dynamicRoutes[O];if(t&&!1===t.fallback&&!e){if(w.experimental.adapterPath)return await F();throw new m.NoFallbackError}}let R=null;!I||N.isDev||D||(R="/index"===(R=S)?"/":R);let M=!0===N.isDev||!I,H=I&&!M;T&&E&&(0,o.setManifestsSingleton)({page:b,clientReferenceManifest:E,serverActionsManifest:T});let z=e.method||"GET",L=(0,i.getTracer)(),B=L.getActiveScopeSpan(),q={params:x,prerenderManifest:j,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts},cacheComponents:!!w.cacheComponents,supportsDynamicResponse:M,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:w.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,n)=>N.onRequestError(e,t,r,n,k)},sharedContext:{buildId:v}},U=new l.NodeNextRequest(e),K=new l.NodeNextResponse(t),_=c.NextRequestAdapter.fromNodeNextRequest(U,(0,c.signalFromNodeResponse)(t));try{let o=async e=>N.handle(_,q).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let a=L.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=a.get("next.route");if(r){let t=`${z} ${r}`;e.setAttributes({"next.route":r,"http.route":r,"next.span_name":t}),e.updateName(t)}else e.updateName(`${z} ${b}`)}),s=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var i,l;let c=async({previousCacheEntry:a})=>{try{if(!s&&A&&$&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await o(n);e.fetchMetrics=q.renderOpts.fetchMetrics;let l=q.renderOpts.pendingWaitUntil;l&&r.waitUntil&&(r.waitUntil(l),l=void 0);let c=q.renderOpts.collectedTags;if(!I)return await (0,f.sendResponse)(U,K,i,q.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(i.headers);c&&(t[g.NEXT_CACHE_TAGS_HEADER]=c),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==q.renderOpts.collectedRevalidate&&!(q.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&q.renderOpts.collectedRevalidate,r=void 0===q.renderOpts.collectedExpire||q.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:q.renderOpts.collectedExpire;return{value:{kind:y.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await N.onRequestError(e,t,{routerKind:"App Router",routePath:b,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:A})},!1,k),t}},d=await N.handleResponse({req:e,nextConfig:w,cacheKey:R,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:j,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:$,responseGenerator:c,waitUntil:r.waitUntil,isMinimalMode:s});if(!I)return null;if((null==d||null==(i=d.value)?void 0:i.kind)!==y.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",A?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),D&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return s&&I||m.delete(g.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,u.getCacheControlHeader)(d.cacheControl)),await (0,f.sendResponse)(U,K,new Response(d.value.body,{headers:m,status:d.value.status||200})),null};B?await l(B):await L.withPropagatedContext(e.headers,()=>L.trace(d.BaseServerSpan.handleRequest,{spanName:`${z} ${b}`,kind:i.SpanKind.SERVER,attributes:{"http.method":z,"http.target":e.url}},l))}catch(t){if(t instanceof m.NoFallbackError||await N.onRequestError(e,t,{routerKind:"App Router",routePath:O,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:A})},!1,k),I)throw t;return await (0,f.sendResponse)(U,K,new Response(null,{status:500})),null}}e.s(["handler",()=>L,"patchFetch",()=>z,"routeModule",()=>N,"serverHooks",()=>H,"workAsyncStorage",()=>R,"workUnitAsyncStorage",()=>M],47482)}];
|
|
791
1130
|
|
|
792
1131
|
//# sourceMappingURL=node_modules_next_dist_esm_build_templates_app-route_d09de205.js.map
|