@humanspeak/svelte-markdown 1.1.0 → 1.2.0
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.
|
@@ -97,14 +97,16 @@
|
|
|
97
97
|
|
|
98
98
|
// Streaming mode: full re-parse + smart in-place diff
|
|
99
99
|
let incrementalParser: IncrementalParser | undefined
|
|
100
|
-
let
|
|
100
|
+
let lastOptionsSrc: typeof options | undefined
|
|
101
|
+
let lastExtensionsSrc: typeof extensions | undefined
|
|
101
102
|
let streamTokens = $state<Token[]>([])
|
|
102
103
|
|
|
103
104
|
$effect(() => {
|
|
104
105
|
if (!streaming || hasAsyncExtension) {
|
|
105
106
|
if (incrementalParser) {
|
|
106
107
|
incrementalParser = undefined
|
|
107
|
-
|
|
108
|
+
lastOptionsSrc = undefined
|
|
109
|
+
lastExtensionsSrc = undefined
|
|
108
110
|
}
|
|
109
111
|
if (streaming && hasAsyncExtension) {
|
|
110
112
|
console.warn(
|
|
@@ -115,9 +117,8 @@
|
|
|
115
117
|
return
|
|
116
118
|
}
|
|
117
119
|
|
|
118
|
-
// Read combinedOptions
|
|
120
|
+
// Read combinedOptions so Svelte tracks it as a dependency
|
|
119
121
|
const currentOptions = combinedOptions
|
|
120
|
-
const optionsKey = JSON.stringify(currentOptions)
|
|
121
122
|
|
|
122
123
|
if (Array.isArray(source)) {
|
|
123
124
|
streamTokens = source as Token[]
|
|
@@ -130,10 +131,11 @@
|
|
|
130
131
|
return
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
// Recreate parser
|
|
134
|
-
if (!incrementalParser ||
|
|
134
|
+
// Recreate parser when user-facing options or extensions change
|
|
135
|
+
if (!incrementalParser || lastOptionsSrc !== options || lastExtensionsSrc !== extensions) {
|
|
135
136
|
incrementalParser = new IncrementalParser(currentOptions)
|
|
136
|
-
|
|
137
|
+
lastOptionsSrc = options
|
|
138
|
+
lastExtensionsSrc = extensions
|
|
137
139
|
}
|
|
138
140
|
const { tokens: newTokens, divergeAt } = incrementalParser.update(source as string)
|
|
139
141
|
|
package/package.json
CHANGED