a4phone 1.5.0 → 1.5.1
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 +1 -1
- package/src/setup.mjs +6 -1
package/package.json
CHANGED
package/src/setup.mjs
CHANGED
|
@@ -348,7 +348,12 @@ function mountDshHook({ profileDir, pluginEntry }) {
|
|
|
348
348
|
const block = dshHookBlock(rel);
|
|
349
349
|
if (content.includes(DSH_MARKER_START) && content.includes(block)) return false;
|
|
350
350
|
|
|
351
|
-
|
|
351
|
+
// 默认模板占位符 `[]` 本身就是一个完整的 YAML 文档;若原样保留再往后追加
|
|
352
|
+
// 条目,文件会变成两个没有 `---` 分隔的文档,DSH 启动解析时报
|
|
353
|
+
// "end of the stream or a document separator is expected",故追加前移除。
|
|
354
|
+
const base = stripDshHookBlocks(content)
|
|
355
|
+
.replace(/^[ \t]*\[\][ \t]*\r?$/m, '')
|
|
356
|
+
.trimEnd().replace(/\n{3,}/g, '\n\n');
|
|
352
357
|
const out = (base ? base + '\n\n' : '') + block + '\n';
|
|
353
358
|
fs.mkdirSync(profileDir, { recursive: true });
|
|
354
359
|
fs.writeFileSync(patchPath, out);
|