@lincyaw/workspace 1.0.0-rc.127 → 1.0.0-rc.129

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": "@lincyaw/workspace",
3
- "version": "1.0.0-rc.127",
3
+ "version": "1.0.0-rc.129",
4
4
  "description": "Presmium's workspace service (presmium serve): documents, their history, reviews and the workspace site",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -35,13 +35,13 @@
35
35
  "mime-types": "3.0.2",
36
36
  "playwright-chromium": "1.64.1",
37
37
  "yaml": "^2.9.1",
38
- "@lincyaw/kernel": "1.0.0-rc.127",
39
- "@lincyaw/design": "1.0.0-rc.127",
40
- "@lincyaw/server": "1.0.0-rc.127",
41
- "@lincyaw/compiler": "1.0.0-rc.127"
38
+ "@lincyaw/compiler": "1.0.0-rc.129",
39
+ "@lincyaw/design": "1.0.0-rc.129",
40
+ "@lincyaw/kernel": "1.0.0-rc.129",
41
+ "@lincyaw/server": "1.0.0-rc.129"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/mime-types": "^3.0.1",
45
- "@lincyaw/mcp": "1.0.0-rc.127"
45
+ "@lincyaw/mcp": "1.0.0-rc.129"
46
46
  }
47
47
  }
@@ -1,7 +1,7 @@
1
1
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs'
2
2
  import { randomBytes } from 'node:crypto'
3
3
  import { dirname, join, relative, resolve, sep } from 'node:path'
4
- import { copyEmbeddedBlock, DOCUMENT_ENTRY, withReferenceFallbacks, freshDocumentId, hasRole, isRecord, ranksBetween, validateDocument } from '@lincyaw/kernel'
4
+ import { copyEmbeddedBlock, DOCUMENT_ENTRY, documentFolderName, withReferenceFallbacks, freshDocumentId, hasRole, isRecord, ranksBetween, validateDocument } from '@lincyaw/kernel'
5
5
  import type { BlockId, DocumentId, Member, PresmiumDocument, TreeOperation, TreeOperationResult } from '@lincyaw/kernel'
6
6
  import { isWithin } from '../domain/paths.ts'
7
7
  import { effectiveContent, isDocumentDir } from './config.ts'
@@ -96,8 +96,6 @@ class Journal {
96
96
  finish() { for (const done of this.#after) { try { done() } catch { /* A leftover in .presmium is harmless. */ } } }
97
97
  }
98
98
 
99
- const slugOf = (title: string) => title.normalize('NFKD').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 48) || 'document'
100
-
101
99
  /**
102
100
  * The workspace's tree operations (docs/authoring-actions.md): each is atomic, the documents it changes are written
103
101
  * together and recorded as one revision, under the documents' locks. Folders are never moved by a move or rename;
@@ -163,7 +161,7 @@ export class TreeOperations {
163
161
 
164
162
  #freshDir(title: string): string {
165
163
  const taken = this.#dirs()
166
- const base = `${NEW_DOCUMENTS_DIR}/${slugOf(title)}`
164
+ const base = `${NEW_DOCUMENTS_DIR}/${documentFolderName(title)}`
167
165
  for (let n = 1; ; n++) {
168
166
  const dir = n === 1 ? base : `${base}-${n}`
169
167
  if (!existsSync(join(this.#root, dir)) && isDocumentDir(this.#options.config, dir) && !taken.some(other => other !== '' && (isWithin(dir, other) || isWithin(other, dir)))) return dir