@openclaw/feishu 2026.10.2 → 2026.10.5-beta.2
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/.setup/{app-registration-BB6TubaW.mjs → app-registration-DQOq5urV.mjs} +13 -32
- package/dist/.setup/{channel-DZakdZ3r.mjs → channel-CjGGyrdx.mjs} +87 -174
- package/dist/.setup/{channel.runtime-rXFuQXLL.mjs → channel.runtime-SaC_uTPM.mjs} +57 -74
- package/dist/.setup/{chat-mTBvMMvx.mjs → chat-fC3dvxFs.mjs} +16 -28
- package/dist/.setup/{client-CcxmEkoy.mjs → client-wwr8PGPH.mjs} +24 -30
- package/dist/.setup/{conversation-id-C1ofUfU8.mjs → conversation-id-D00i9uy5.mjs} +5 -10
- package/dist/.setup/{doctor-contract-DyOo8NvC.mjs → doctor-contract-oIpUWtNO.mjs} +8 -15
- package/dist/.setup/{monitor-CXaFHMmi.mjs → monitor-Yt__BUki.mjs} +33 -54
- package/dist/.setup/{monitor.account-cJ8gavqv.mjs → monitor.account-CVz16781.mjs} +359 -658
- package/dist/.setup/{probe-BjSykXB8.mjs → probe-DXnFxq5j.mjs} +14 -17
- package/dist/.setup/{reply-delivery-result-laBNOmBu.mjs → reply-delivery-result-iCCrdxE1.mjs} +153 -181
- package/dist/.setup/{session-conversation-C53IEUWt.mjs → session-conversation-BSBNK5Mq.mjs} +1 -1
- package/dist/.setup/{setup-api-fZcYXGxe.mjs → setup-api-B_LFQQ-Q.mjs} +1 -1
- package/dist/.setup/{subagent-hooks-C8Z_x3KJ.mjs → subagent-hooks-9Pc1-k37.mjs} +7 -17
- package/dist/.setup/{thread-bindings-jW2x5VuN.mjs → thread-bindings-DdNLxoL3.mjs} +21 -44
- package/dist/api.js +218 -326
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/subagent-hooks-api.js +1 -1
- package/node_modules/@openclaw/fs-safe/CHANGELOG.md +35 -0
- package/node_modules/@openclaw/fs-safe/README.md +1 -1
- package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/archive-durability.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/archive-merge.js +4 -4
- package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-read.js +5 -4
- package/node_modules/@openclaw/fs-safe/dist/archive-staging.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/archive-staging.js +22 -38
- package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.d.ts +17 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +117 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.d.ts +8 -5
- package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +27 -50
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.js +57 -11
- package/node_modules/@openclaw/fs-safe/dist/guarded-mutation.js +5 -5
- package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +52 -5
- package/node_modules/@openclaw/fs-safe/dist/guest.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/native-operations.d.ts +0 -1
- package/node_modules/@openclaw/fs-safe/dist/native-operations.js +22 -26
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +5 -1
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +4 -1
- package/node_modules/@openclaw/fs-safe/dist/permission-exec.js +2 -1
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +6 -1
- package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/publish-file.js +34 -7
- package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.js +1 -4
- package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +6 -0
- package/node_modules/@openclaw/fs-safe/dist/root-create-input.d.ts +15 -1
- package/node_modules/@openclaw/fs-safe/dist/root-create-input.js +4 -0
- package/node_modules/@openclaw/fs-safe/dist/root-directory-entry.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +0 -1
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +6 -12
- package/node_modules/@openclaw/fs-safe/dist/root-impl.js +15 -15
- package/node_modules/@openclaw/fs-safe/dist/root-paths.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/root-walk.js +4 -4
- package/node_modules/@openclaw/fs-safe/dist/root-write-verification.d.ts +10 -1
- package/node_modules/@openclaw/fs-safe/dist/root-write-verification.js +20 -0
- package/node_modules/@openclaw/fs-safe/dist/secure-temp-dir.js +19 -7
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.js +25 -3
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.d.ts +14 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.js +187 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock.js +15 -1
- package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.d.ts +10 -0
- package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.js +29 -0
- package/node_modules/@openclaw/fs-safe/dist/temp-target.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-admission.js +6 -6
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.d.ts +4 -4
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +17 -16
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.js +20 -28
- package/node_modules/@openclaw/fs-safe/dist/walk.js +2 -13
- package/node_modules/@openclaw/fs-safe/dist/watch-native.d.ts +2 -2
- package/node_modules/@openclaw/fs-safe/dist/watch-native.js +3 -1
- package/node_modules/@openclaw/fs-safe/dist/watch-rescan.js +3 -9
- package/node_modules/@openclaw/fs-safe/dist/watch.js +2 -3
- package/node_modules/@openclaw/fs-safe/docs/advanced.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/archive.md +3 -0
- package/node_modules/@openclaw/fs-safe/docs/atomic.md +11 -3
- package/node_modules/@openclaw/fs-safe/docs/contributing.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/copy.md +48 -0
- package/node_modules/@openclaw/fs-safe/docs/guest.md +21 -4
- package/node_modules/@openclaw/fs-safe/docs/path-scope.md +4 -0
- package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +46 -8
- package/node_modules/@openclaw/fs-safe/docs/temp.md +12 -0
- package/node_modules/@openclaw/fs-safe/docs/watch.md +3 -2
- package/node_modules/@openclaw/fs-safe/package.json +15 -15
- package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
- package/node_modules/follow-redirects/index.js +10 -1
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/mdast-util-to-markdown/index.d.ts +2 -0
- package/node_modules/mdast-util-to-markdown/lib/configure.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/configure.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/configure.js +19 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js +12 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/break.js +16 -5
- package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/code.js +13 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/definition.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts +30 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js +39 -41
- package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/heading.js +11 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/html.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts +10 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js +17 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts +10 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/image.js +10 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts +9 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js +14 -4
- package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts +10 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js +17 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts +13 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/link.js +24 -9
- package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/list-item.js +12 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/list.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/root.js +13 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts +30 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/strong.js +39 -41
- package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/text.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts +6 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js +6 -0
- package/node_modules/mdast-util-to-markdown/lib/index.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/index.js +34 -8
- package/node_modules/mdast-util-to-markdown/lib/join.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/join.js +18 -1
- package/node_modules/mdast-util-to-markdown/lib/types.d.ts +50 -30
- package/node_modules/mdast-util-to-markdown/lib/unsafe.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/unsafe.js +15 -1
- package/node_modules/mdast-util-to-markdown/lib/util/character.d.ts +23 -0
- package/node_modules/mdast-util-to-markdown/lib/util/character.d.ts.map +1 -0
- package/node_modules/mdast-util-to-markdown/lib/util/character.js +32 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-fence.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-quote.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-strong.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js +3 -1
- package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts +2 -0
- package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/container-flow.js +9 -0
- package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts +95 -4
- package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js +636 -57
- package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts +2 -2
- package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/encode-info.js +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js +12 -7
- package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js +7 -2
- package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js +20 -15
- package/node_modules/mdast-util-to-markdown/lib/util/html-kind.d.ts +31 -0
- package/node_modules/mdast-util-to-markdown/lib/util/html-kind.d.ts.map +1 -0
- package/node_modules/mdast-util-to-markdown/lib/util/html-kind.js +63 -0
- package/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js +11 -0
- package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts +2 -2
- package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/safe.js +71 -7
- package/node_modules/mdast-util-to-markdown/package.json +13 -57
- package/node_modules/mdast-util-to-markdown/readme.md +139 -84
- package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/compile.js +14 -4
- package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
- package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
- package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
- package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/preprocess.js +19 -21
- package/node_modules/micromark/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/lib/compile.js +37 -29
- package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/lib/create-tokenizer.js +37 -35
- package/node_modules/micromark/lib/initialize/document.js +21 -13
- package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/lib/initialize/text.js +7 -3
- package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/lib/preprocess.js +16 -19
- package/node_modules/micromark/package.json +2 -15
- package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
- package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
- package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
- package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
- package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
- package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
- package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
- package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
- package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
- package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
- package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
- package/node_modules/micromark-core-commonmark/package.json +4 -16
- package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/dev/index.js +58 -3
- package/node_modules/micromark-factory-space/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/index.js +55 -3
- package/node_modules/micromark-factory-space/package.json +1 -10
- package/node_modules/micromark-factory-space/readme.md +25 -25
- package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
- package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/index.js +225 -0
- package/node_modules/micromark-util-edit-map/license +22 -0
- package/node_modules/micromark-util-edit-map/package.json +48 -0
- package/node_modules/micromark-util-edit-map/readme.md +234 -0
- package/node_modules/micromark-util-types/index.d.ts +6 -3
- package/node_modules/micromark-util-types/package.json +2 -36
- package/node_modules/ws/lib/websocket.js +17 -3
- package/node_modules/ws/package.json +1 -1
- package/package.json +5 -5
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.d.ts +0 -17
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.js +0 -66
- package/node_modules/@openclaw/fs-safe/dist/publish-file-native.d.ts +0 -4
- package/node_modules/@openclaw/fs-safe/dist/publish-file-native.js +0 -35
- package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.d.ts +0 -7
- package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.js +0 -16
- package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts +0 -7
- package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts.map +0 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { markdownSpace } from 'micromark-util-character';
|
|
6
6
|
|
|
7
|
-
// To do: implement `
|
|
7
|
+
// To do: implement `spaceOrTabWithOptions` (`connect`, `content`).
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Parse spaces and tabs.
|
|
@@ -32,14 +32,14 @@ import { markdownSpace } from 'micromark-util-character';
|
|
|
32
32
|
* @param {State} ok
|
|
33
33
|
* State switched to when successful.
|
|
34
34
|
* @param {TokenType} type
|
|
35
|
-
* Type
|
|
35
|
+
* Type of the whole whitespace.
|
|
36
36
|
* @param {number | undefined} [max=Infinity]
|
|
37
37
|
* Max (exclusive).
|
|
38
38
|
* @returns {State}
|
|
39
39
|
* Start state.
|
|
40
40
|
*/
|
|
41
41
|
export function factorySpace(effects, ok, type, max) {
|
|
42
|
-
const limit = max ? max - 1 :
|
|
42
|
+
const limit = max ? max - 1 : Infinity;
|
|
43
43
|
let size = 0;
|
|
44
44
|
return start;
|
|
45
45
|
|
|
@@ -61,4 +61,56 @@ export function factorySpace(effects, ok, type, max) {
|
|
|
61
61
|
effects.exit(type);
|
|
62
62
|
return ok(code);
|
|
63
63
|
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Parse spaces and tabs, with a required minimum and maximum, matching
|
|
68
|
+
* `markdown-rs`’s `space_or_tab_min_max`.
|
|
69
|
+
*
|
|
70
|
+
* Unlike `factorySpace`, this can fail: `nok` is used when fewer than
|
|
71
|
+
* `min` spaces or tabs are found.
|
|
72
|
+
*
|
|
73
|
+
* @param {Effects} effects
|
|
74
|
+
* Context.
|
|
75
|
+
* @param {State} ok
|
|
76
|
+
* State switched to when successful.
|
|
77
|
+
* @param {State} nok
|
|
78
|
+
* State switched to when unsuccessful.
|
|
79
|
+
* @param {TokenType} type
|
|
80
|
+
* Type of the whole whitespace.
|
|
81
|
+
* @param {number} min
|
|
82
|
+
* Minimum allowed characters (inclusive).
|
|
83
|
+
* @param {number} max
|
|
84
|
+
* Maximum allowed characters (inclusive).
|
|
85
|
+
* @returns {State}
|
|
86
|
+
* Start state.
|
|
87
|
+
*/
|
|
88
|
+
export function factorySpaceMinMax(effects, ok, nok, type, min, max) {
|
|
89
|
+
let size = 0;
|
|
90
|
+
return start;
|
|
91
|
+
|
|
92
|
+
/** @type {State} */
|
|
93
|
+
function start(code) {
|
|
94
|
+
if (max > 0 && markdownSpace(code)) {
|
|
95
|
+
effects.enter(type);
|
|
96
|
+
return prefix(code);
|
|
97
|
+
}
|
|
98
|
+
return after(code);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** @type {State} */
|
|
102
|
+
function prefix(code) {
|
|
103
|
+
if (markdownSpace(code) && size < max) {
|
|
104
|
+
effects.consume(code);
|
|
105
|
+
size++;
|
|
106
|
+
return prefix;
|
|
107
|
+
}
|
|
108
|
+
effects.exit(type);
|
|
109
|
+
return after(code);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** @type {State} */
|
|
113
|
+
function after(code) {
|
|
114
|
+
return size >= min ? ok(code) : nok(code);
|
|
115
|
+
}
|
|
64
116
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "micromark-factory-space",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "micromark factory to parse markdown space (found in lots of places)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -42,14 +42,5 @@
|
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "micromark-build"
|
|
45
|
-
},
|
|
46
|
-
"xo": {
|
|
47
|
-
"envs": [
|
|
48
|
-
"shared-node-browser"
|
|
49
|
-
],
|
|
50
|
-
"prettier": true,
|
|
51
|
-
"rules": {
|
|
52
|
-
"unicorn/prefer-code-point": "off"
|
|
53
|
-
}
|
|
54
45
|
}
|
|
55
46
|
}
|
|
@@ -170,56 +170,56 @@ abide by its terms.
|
|
|
170
170
|
|
|
171
171
|
<!-- Definitions -->
|
|
172
172
|
|
|
173
|
-
[
|
|
173
|
+
[api-factory-space]: #factoryspace
|
|
174
174
|
|
|
175
|
-
[
|
|
175
|
+
[author]: https://wooorm.com
|
|
176
176
|
|
|
177
|
-
[
|
|
177
|
+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
|
178
178
|
|
|
179
|
-
[
|
|
179
|
+
[build]: https://github.com/micromark/micromark/actions
|
|
180
180
|
|
|
181
|
-
[
|
|
181
|
+
[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg
|
|
182
182
|
|
|
183
|
-
[
|
|
183
|
+
[bundle-size]: https://bundlejs.com/?q=micromark-factory-space
|
|
184
184
|
|
|
185
185
|
[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-space
|
|
186
186
|
|
|
187
|
-
[
|
|
187
|
+
[chat]: https://github.com/micromark/micromark/discussions
|
|
188
188
|
|
|
189
|
-
[
|
|
189
|
+
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
|
190
190
|
|
|
191
|
-
[
|
|
191
|
+
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
|
|
192
192
|
|
|
193
|
-
[
|
|
193
|
+
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md
|
|
194
194
|
|
|
195
|
-
[
|
|
195
|
+
[coverage]: https://codecov.io/github/micromark/micromark
|
|
196
|
+
|
|
197
|
+
[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg
|
|
198
|
+
|
|
199
|
+
[downloads]: https://www.npmjs.com/package/micromark-factory-space
|
|
200
|
+
|
|
201
|
+
[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-space.svg
|
|
196
202
|
|
|
197
203
|
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
|
198
204
|
|
|
199
205
|
[esmsh]: https://esm.sh
|
|
200
206
|
|
|
201
|
-
[
|
|
202
|
-
|
|
203
|
-
[chat]: https://github.com/micromark/micromark/discussions
|
|
207
|
+
[health]: https://github.com/micromark/.github
|
|
204
208
|
|
|
205
209
|
[license]: https://github.com/micromark/micromark/blob/main/license
|
|
206
210
|
|
|
207
|
-
[
|
|
211
|
+
[markdown-space]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-character#markdownspacecode
|
|
208
212
|
|
|
209
|
-
[
|
|
213
|
+
[micromark]: https://github.com/micromark/micromark
|
|
210
214
|
|
|
211
|
-
[
|
|
215
|
+
[npm]: https://docs.npmjs.com/cli/install
|
|
212
216
|
|
|
213
|
-
[
|
|
217
|
+
[opencollective]: https://opencollective.com/unified
|
|
214
218
|
|
|
215
|
-
[
|
|
219
|
+
[securitymd]: https://github.com/micromark/.github/blob/main/security.md
|
|
216
220
|
|
|
217
|
-
[
|
|
221
|
+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
|
218
222
|
|
|
219
|
-
[
|
|
223
|
+
[support]: https://github.com/micromark/.github/blob/main/support.md
|
|
220
224
|
|
|
221
225
|
[typescript]: https://www.typescriptlang.org
|
|
222
|
-
|
|
223
|
-
[micromark]: https://github.com/micromark/micromark
|
|
224
|
-
|
|
225
|
-
[api-factory-space]: #factoryspace
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Event} from 'micromark-util-types'
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {[number, number, Array<Event>]} Change
|
|
6
|
+
* @typedef {[number, number, number]} Jump
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Tracks a bunch of edits.
|
|
10
|
+
*
|
|
11
|
+
* Port of `edit_map.rs` from `markdown-rs`:
|
|
12
|
+
* <https://github.com/wooorm/markdown-rs/blob/1506572f/src/util/edit_map.rs>.
|
|
13
|
+
*
|
|
14
|
+
* Deal with several changes in events, batching them together.
|
|
15
|
+
*
|
|
16
|
+
* Preferably, changes should be kept to a minimum.
|
|
17
|
+
* Sometimes, it’s needed to change the list of events, because parsing can be
|
|
18
|
+
* messy, and it helps to expose a cleaner interface of events to the compiler
|
|
19
|
+
* and other users.
|
|
20
|
+
* It can also help to merge many adjacent similar events.
|
|
21
|
+
* And, in other cases, it’s needed to parse subcontent: pass some events
|
|
22
|
+
* through another tokenizer and inject the result.
|
|
23
|
+
*/
|
|
24
|
+
export class EditMap {
|
|
25
|
+
/**
|
|
26
|
+
* Changes by index, so `add` does not need to scan `map` (which is
|
|
27
|
+
* quadratic for documents with many edits at different places).
|
|
28
|
+
*
|
|
29
|
+
* @type {Map<number, Change>}
|
|
30
|
+
*/
|
|
31
|
+
index: Map<number, Change>;
|
|
32
|
+
/**
|
|
33
|
+
* Record of changes.
|
|
34
|
+
*
|
|
35
|
+
* @type {Array<Change>}
|
|
36
|
+
*/
|
|
37
|
+
map: Array<Change>;
|
|
38
|
+
/**
|
|
39
|
+
* Create an edit: a remove and/or add at a certain place.
|
|
40
|
+
*
|
|
41
|
+
* @param {number} index
|
|
42
|
+
* Index at which to apply the edit.
|
|
43
|
+
* @param {number} remove
|
|
44
|
+
* Count of items to remove at the index.
|
|
45
|
+
* @param {Array<Event>} add
|
|
46
|
+
* Items to add at the index.
|
|
47
|
+
* @returns {undefined}
|
|
48
|
+
* Nothing.
|
|
49
|
+
*/
|
|
50
|
+
add(index: number, remove: number, add: Array<Event>): undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Create an edit: but insert `add` before existing additions, instead of
|
|
53
|
+
* after them.
|
|
54
|
+
*
|
|
55
|
+
* @param {number} index
|
|
56
|
+
* Index at which to apply the edit.
|
|
57
|
+
* @param {number} remove
|
|
58
|
+
* Count of items to remove at the index.
|
|
59
|
+
* @param {Array<Event>} add
|
|
60
|
+
* Items to add at the index.
|
|
61
|
+
* @returns {undefined}
|
|
62
|
+
* Nothing.
|
|
63
|
+
*/
|
|
64
|
+
addBefore(index: number, remove: number, add: Array<Event>): undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Done, change the events.
|
|
67
|
+
*
|
|
68
|
+
* @param {Array<Event>} events
|
|
69
|
+
* List of events to apply the edits to.
|
|
70
|
+
* @returns {undefined}
|
|
71
|
+
* Nothing.
|
|
72
|
+
*/
|
|
73
|
+
consume(events: Array<Event>): undefined;
|
|
74
|
+
}
|
|
75
|
+
export type Change = [number, number, Array<Event>];
|
|
76
|
+
export type Jump = [number, number, number];
|
|
77
|
+
import type { Event } from 'micromark-util-types';
|
|
78
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AACH;IAQI;;;;;OAKG;IACH,OAFU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAEP;IAEtB;;;;OAIG;IACH,KAFU,KAAK,CAAC,MAAM,CAAC,CAEV;IAGf;;;;;;;;;;;OAWG;IACH,WATW,MAAM,UAEN,MAAM,OAEN,KAAK,CAAC,KAAK,CAAC,GAEV,SAAS,CAKrB;IAED;;;;;;;;;;;;OAYG;IACH,iBATW,MAAM,UAEN,MAAM,OAEN,KAAK,CAAC,KAAK,CAAC,GAEV,SAAS,CAKrB;IAED;;;;;;;OAOG;IACH,gBALW,KAAK,CAAC,KAAK,CAAC,GAEV,SAAS,CA4DrB;CACF;qBA/IY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;mBAC9B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;2BALb,sBAAsB"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Event} from 'micromark-util-types'
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {[number, number, Array<Event>]} Change
|
|
7
|
+
* @typedef {[number, number, number]} Jump
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Tracks a bunch of edits.
|
|
12
|
+
*
|
|
13
|
+
* Port of `edit_map.rs` from `markdown-rs`:
|
|
14
|
+
* <https://github.com/wooorm/markdown-rs/blob/1506572f/src/util/edit_map.rs>.
|
|
15
|
+
*
|
|
16
|
+
* Deal with several changes in events, batching them together.
|
|
17
|
+
*
|
|
18
|
+
* Preferably, changes should be kept to a minimum.
|
|
19
|
+
* Sometimes, it’s needed to change the list of events, because parsing can be
|
|
20
|
+
* messy, and it helps to expose a cleaner interface of events to the compiler
|
|
21
|
+
* and other users.
|
|
22
|
+
* It can also help to merge many adjacent similar events.
|
|
23
|
+
* And, in other cases, it’s needed to parse subcontent: pass some events
|
|
24
|
+
* through another tokenizer and inject the result.
|
|
25
|
+
*/
|
|
26
|
+
export class EditMap {
|
|
27
|
+
/**
|
|
28
|
+
* Create a new edit map.
|
|
29
|
+
*
|
|
30
|
+
* @returns
|
|
31
|
+
* New instance.
|
|
32
|
+
*/
|
|
33
|
+
constructor() {
|
|
34
|
+
/**
|
|
35
|
+
* Changes by index, so `add` does not need to scan `map` (which is
|
|
36
|
+
* quadratic for documents with many edits at different places).
|
|
37
|
+
*
|
|
38
|
+
* @type {Map<number, Change>}
|
|
39
|
+
*/
|
|
40
|
+
this.index = new Map()
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Record of changes.
|
|
44
|
+
*
|
|
45
|
+
* @type {Array<Change>}
|
|
46
|
+
*/
|
|
47
|
+
this.map = []
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Create an edit: a remove and/or add at a certain place.
|
|
52
|
+
*
|
|
53
|
+
* @param {number} index
|
|
54
|
+
* Index at which to apply the edit.
|
|
55
|
+
* @param {number} remove
|
|
56
|
+
* Count of items to remove at the index.
|
|
57
|
+
* @param {Array<Event>} add
|
|
58
|
+
* Items to add at the index.
|
|
59
|
+
* @returns {undefined}
|
|
60
|
+
* Nothing.
|
|
61
|
+
*/
|
|
62
|
+
add(index, remove, add) {
|
|
63
|
+
addImplementation(this, index, remove, add, false)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Create an edit: but insert `add` before existing additions, instead of
|
|
68
|
+
* after them.
|
|
69
|
+
*
|
|
70
|
+
* @param {number} index
|
|
71
|
+
* Index at which to apply the edit.
|
|
72
|
+
* @param {number} remove
|
|
73
|
+
* Count of items to remove at the index.
|
|
74
|
+
* @param {Array<Event>} add
|
|
75
|
+
* Items to add at the index.
|
|
76
|
+
* @returns {undefined}
|
|
77
|
+
* Nothing.
|
|
78
|
+
*/
|
|
79
|
+
addBefore(index, remove, add) {
|
|
80
|
+
addImplementation(this, index, remove, add, true)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Done, change the events.
|
|
85
|
+
*
|
|
86
|
+
* @param {Array<Event>} events
|
|
87
|
+
* List of events to apply the edits to.
|
|
88
|
+
* @returns {undefined}
|
|
89
|
+
* Nothing.
|
|
90
|
+
*/
|
|
91
|
+
consume(events) {
|
|
92
|
+
this.map.sort(function (a, b) {
|
|
93
|
+
return a[0] - b[0]
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
if (this.map.length === 0) {
|
|
97
|
+
return
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// To do: if links are added in events, like they are in `markdown-rs`,
|
|
101
|
+
// this is needed.
|
|
102
|
+
// // Calculate jumps: where items in the current list move to.
|
|
103
|
+
// /** @type {Array<Jump>} */
|
|
104
|
+
// const jumps = []
|
|
105
|
+
// let index = 0
|
|
106
|
+
// let addAcc = 0
|
|
107
|
+
// let removeAcc = 0
|
|
108
|
+
// while (index < this.map.length) {
|
|
109
|
+
// const [at, remove, add] = this.map[index]
|
|
110
|
+
// removeAcc += remove
|
|
111
|
+
// addAcc += add.length
|
|
112
|
+
// jumps.push([at, removeAcc, addAcc])
|
|
113
|
+
// index += 1
|
|
114
|
+
// }
|
|
115
|
+
//
|
|
116
|
+
// shiftLinks(events, jumps)
|
|
117
|
+
|
|
118
|
+
let index = this.map.length
|
|
119
|
+
/** @type {Array<Array<Event>>} */
|
|
120
|
+
const vecs = []
|
|
121
|
+
while (index > 0) {
|
|
122
|
+
index -= 1
|
|
123
|
+
vecs.push(
|
|
124
|
+
events.slice(this.map[index][0] + this.map[index][1]),
|
|
125
|
+
this.map[index][2]
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
// Truncate rest.
|
|
129
|
+
events.length = this.map[index][0]
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
vecs.push(events.slice())
|
|
133
|
+
events.length = 0
|
|
134
|
+
|
|
135
|
+
let slice = vecs.pop()
|
|
136
|
+
|
|
137
|
+
while (slice) {
|
|
138
|
+
for (const element of slice) {
|
|
139
|
+
events.push(element)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
slice = vecs.pop()
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Truncate everything.
|
|
146
|
+
this.map.length = 0
|
|
147
|
+
this.index.clear()
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Create an edit.
|
|
153
|
+
*
|
|
154
|
+
* @param {EditMap} editMap
|
|
155
|
+
* Edit map to apply to.
|
|
156
|
+
* @param {number} at
|
|
157
|
+
* Index at which to apply the edit.
|
|
158
|
+
* @param {number} remove
|
|
159
|
+
* Count of items to remove at the index.
|
|
160
|
+
* @param {Array<Event>} add
|
|
161
|
+
* Items to add at the index.
|
|
162
|
+
* @param {boolean} before
|
|
163
|
+
* Insert `add` before existing additions at `at`, instead of after them.
|
|
164
|
+
* @returns {undefined}
|
|
165
|
+
* Nothing.
|
|
166
|
+
*/
|
|
167
|
+
function addImplementation(editMap, at, remove, add, before) {
|
|
168
|
+
if (remove === 0 && add.length === 0) {
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const existing = editMap.index.get(at)
|
|
173
|
+
|
|
174
|
+
if (existing) {
|
|
175
|
+
existing[1] += remove
|
|
176
|
+
|
|
177
|
+
if (before) {
|
|
178
|
+
add.push(...existing[2])
|
|
179
|
+
existing[2] = add
|
|
180
|
+
} else {
|
|
181
|
+
existing[2].push(...add)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** @type {Change} */
|
|
188
|
+
const change = [at, remove, add]
|
|
189
|
+
editMap.map.push(change)
|
|
190
|
+
editMap.index.set(at, change)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// /**
|
|
194
|
+
// * Shift `previous` and `next` links according to `jumps`.
|
|
195
|
+
// *
|
|
196
|
+
// * This fixes links in case there are events removed or added between them.
|
|
197
|
+
// *
|
|
198
|
+
// * @param {Array<Event>} events
|
|
199
|
+
// * @param {Array<Jump>} jumps
|
|
200
|
+
// */
|
|
201
|
+
// function shiftLinks(events, jumps) {
|
|
202
|
+
// let jumpIndex = 0
|
|
203
|
+
// let index = 0
|
|
204
|
+
// let add = 0
|
|
205
|
+
// let rm = 0
|
|
206
|
+
|
|
207
|
+
// while (index < events.length) {
|
|
208
|
+
// const rmCurr = rm
|
|
209
|
+
|
|
210
|
+
// while (jumpIndex < jumps.length && jumps[jumpIndex][0] <= index) {
|
|
211
|
+
// add = jumps[jumpIndex][2]
|
|
212
|
+
// rm = jumps[jumpIndex][1]
|
|
213
|
+
// jumpIndex += 1
|
|
214
|
+
// }
|
|
215
|
+
|
|
216
|
+
// // Ignore items that will be removed.
|
|
217
|
+
// if (rm > rmCurr) {
|
|
218
|
+
// index += rm - rmCurr
|
|
219
|
+
// } else {
|
|
220
|
+
// // ?
|
|
221
|
+
// // if let Some(link) = &events[index].link {
|
|
222
|
+
// // if let Some(next) = link.next {
|
|
223
|
+
// // events[next].link.as_mut().unwrap().previous = Some(index + add - rm);
|
|
224
|
+
// // while jumpIndex < jumps.len() && jumps[jumpIndex].0 <= next {
|
|
225
|
+
// // add = jumps[jumpIndex].2;
|
|
226
|
+
// // rm = jumps[jumpIndex].1;
|
|
227
|
+
// // jumpIndex += 1;
|
|
228
|
+
// // }
|
|
229
|
+
// // events[index].link.as_mut().unwrap().next = Some(next + add - rm);
|
|
230
|
+
// // index = next;
|
|
231
|
+
// // continue;
|
|
232
|
+
// // }
|
|
233
|
+
// // }
|
|
234
|
+
// index += 1
|
|
235
|
+
// }
|
|
236
|
+
// }
|
|
237
|
+
// }
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Event} from 'micromark-util-types'
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {[number, number, Array<Event>]} Change
|
|
6
|
+
* @typedef {[number, number, number]} Jump
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Tracks a bunch of edits.
|
|
10
|
+
*
|
|
11
|
+
* Port of `edit_map.rs` from `markdown-rs`:
|
|
12
|
+
* <https://github.com/wooorm/markdown-rs/blob/1506572f/src/util/edit_map.rs>.
|
|
13
|
+
*
|
|
14
|
+
* Deal with several changes in events, batching them together.
|
|
15
|
+
*
|
|
16
|
+
* Preferably, changes should be kept to a minimum.
|
|
17
|
+
* Sometimes, it’s needed to change the list of events, because parsing can be
|
|
18
|
+
* messy, and it helps to expose a cleaner interface of events to the compiler
|
|
19
|
+
* and other users.
|
|
20
|
+
* It can also help to merge many adjacent similar events.
|
|
21
|
+
* And, in other cases, it’s needed to parse subcontent: pass some events
|
|
22
|
+
* through another tokenizer and inject the result.
|
|
23
|
+
*/
|
|
24
|
+
export class EditMap {
|
|
25
|
+
/**
|
|
26
|
+
* Changes by index, so `add` does not need to scan `map` (which is
|
|
27
|
+
* quadratic for documents with many edits at different places).
|
|
28
|
+
*
|
|
29
|
+
* @type {Map<number, Change>}
|
|
30
|
+
*/
|
|
31
|
+
index: Map<number, Change>;
|
|
32
|
+
/**
|
|
33
|
+
* Record of changes.
|
|
34
|
+
*
|
|
35
|
+
* @type {Array<Change>}
|
|
36
|
+
*/
|
|
37
|
+
map: Array<Change>;
|
|
38
|
+
/**
|
|
39
|
+
* Create an edit: a remove and/or add at a certain place.
|
|
40
|
+
*
|
|
41
|
+
* @param {number} index
|
|
42
|
+
* Index at which to apply the edit.
|
|
43
|
+
* @param {number} remove
|
|
44
|
+
* Count of items to remove at the index.
|
|
45
|
+
* @param {Array<Event>} add
|
|
46
|
+
* Items to add at the index.
|
|
47
|
+
* @returns {undefined}
|
|
48
|
+
* Nothing.
|
|
49
|
+
*/
|
|
50
|
+
add(index: number, remove: number, add: Array<Event>): undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Create an edit: but insert `add` before existing additions, instead of
|
|
53
|
+
* after them.
|
|
54
|
+
*
|
|
55
|
+
* @param {number} index
|
|
56
|
+
* Index at which to apply the edit.
|
|
57
|
+
* @param {number} remove
|
|
58
|
+
* Count of items to remove at the index.
|
|
59
|
+
* @param {Array<Event>} add
|
|
60
|
+
* Items to add at the index.
|
|
61
|
+
* @returns {undefined}
|
|
62
|
+
* Nothing.
|
|
63
|
+
*/
|
|
64
|
+
addBefore(index: number, remove: number, add: Array<Event>): undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Done, change the events.
|
|
67
|
+
*
|
|
68
|
+
* @param {Array<Event>} events
|
|
69
|
+
* List of events to apply the edits to.
|
|
70
|
+
* @returns {undefined}
|
|
71
|
+
* Nothing.
|
|
72
|
+
*/
|
|
73
|
+
consume(events: Array<Event>): undefined;
|
|
74
|
+
}
|
|
75
|
+
export type Change = [number, number, Array<Event>];
|
|
76
|
+
export type Jump = [number, number, number];
|
|
77
|
+
import type { Event } from 'micromark-util-types';
|
|
78
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AACH;IAQI;;;;;OAKG;IACH,OAFU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAEP;IAEtB;;;;OAIG;IACH,KAFU,KAAK,CAAC,MAAM,CAAC,CAEV;IAGf;;;;;;;;;;;OAWG;IACH,WATW,MAAM,UAEN,MAAM,OAEN,KAAK,CAAC,KAAK,CAAC,GAEV,SAAS,CAKrB;IAED;;;;;;;;;;;;OAYG;IACH,iBATW,MAAM,UAEN,MAAM,OAEN,KAAK,CAAC,KAAK,CAAC,GAEV,SAAS,CAKrB;IAED;;;;;;;OAOG;IACH,gBALW,KAAK,CAAC,KAAK,CAAC,GAEV,SAAS,CA4DrB;CACF;qBA/IY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;mBAC9B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;2BALb,sBAAsB"}
|