@stream-mdx/worker 0.0.0 → 0.0.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.
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
6
  var __copyProps = (to, from, except, desc) => {
11
7
  if (from && typeof from === "object" || typeof from === "function") {
12
8
  for (let key of __getOwnPropNames(from))
@@ -15,126 +11,15 @@ var __copyProps = (to, from, except, desc) => {
15
11
  }
16
12
  return to;
17
13
  };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
16
 
20
17
  // src/streaming/custom-matcher.ts
21
18
  var custom_matcher_exports = {};
22
- __export(custom_matcher_exports, {
23
- CustomStreamingMatcher: () => CustomStreamingMatcher
24
- });
25
19
  module.exports = __toCommonJS(custom_matcher_exports);
26
- var CustomStreamingMatcher = class {
27
- constructor(pattern) {
28
- this.buffer = "";
29
- this.possibleMatches = [];
30
- this.pattern = pattern;
31
- }
32
- /**
33
- * Add character to buffer and check for matches
34
- */
35
- addCharacter(char) {
36
- this.buffer += char;
37
- const fullMatch = this.buffer.match(this.pattern);
38
- if (fullMatch && fullMatch.index === 0) {
39
- const match = {
40
- matched: true,
41
- content: fullMatch[0],
42
- length: fullMatch[0].length,
43
- isComplete: true
44
- };
45
- this.buffer = this.buffer.slice(fullMatch[0].length);
46
- this.possibleMatches = [];
47
- return match;
48
- }
49
- const confidence = this.calculatePartialConfidence();
50
- return {
51
- matched: false,
52
- content: this.buffer,
53
- length: this.buffer.length,
54
- isComplete: false,
55
- confidence
56
- };
57
- }
58
- /**
59
- * Add string to buffer and check for matches
60
- */
61
- addString(str) {
62
- const results = [];
63
- for (const char of str) {
64
- const result = this.addCharacter(char);
65
- if (result.matched) {
66
- results.push(result);
67
- }
68
- }
69
- if (results.length === 0 && this.buffer.length > 0) {
70
- results.push({
71
- matched: false,
72
- content: this.buffer,
73
- length: this.buffer.length,
74
- isComplete: false,
75
- confidence: this.calculatePartialConfidence()
76
- });
77
- }
78
- return results;
79
- }
80
- /**
81
- * Check if current buffer could lead to a match
82
- */
83
- couldMatch() {
84
- if (this.buffer.length === 0) return true;
85
- const patternSource = this.pattern.source;
86
- const flags = this.pattern.flags;
87
- try {
88
- const partialPattern = new RegExp(`^${patternSource.replace(/\$$/, "")}`, flags);
89
- const testString = this.buffer + "X".repeat(100);
90
- return partialPattern.test(testString);
91
- } catch {
92
- return this.isValidPrefix();
93
- }
94
- }
95
- /**
96
- * Reset the matcher
97
- */
98
- reset() {
99
- this.buffer = "";
100
- this.possibleMatches = [];
101
- }
102
- /**
103
- * Get current buffer content
104
- */
105
- getBuffer() {
106
- return this.buffer;
107
- }
108
- /**
109
- * Calculate confidence for partial matches
110
- */
111
- calculatePartialConfidence() {
112
- if (this.buffer.length === 0) return 0;
113
- let confidence = 0.1;
114
- confidence += Math.min(0.4, this.buffer.length * 0.1);
115
- if (this.couldMatch()) {
116
- confidence += 0.3;
117
- }
118
- if (this.buffer.startsWith("$")) confidence += 0.2;
119
- if (this.buffer.startsWith("$$")) confidence += 0.3;
120
- return Math.min(1, confidence);
121
- }
122
- /**
123
- * Check if current buffer is a valid prefix
124
- */
125
- isValidPrefix() {
126
- const patternStr = this.pattern.source;
127
- if (patternStr.includes("\\$\\$") && (this.buffer === "$" || this.buffer === "$$")) {
128
- return true;
129
- }
130
- if (patternStr.includes("\\$") && this.buffer === "$") {
131
- return true;
132
- }
133
- return false;
134
- }
135
- };
20
+ __reExport(custom_matcher_exports, require("@stream-mdx/core/streaming/custom-matcher"), module.exports);
136
21
  // Annotate the CommonJS export names for ESM import in node:
137
22
  0 && (module.exports = {
138
- CustomStreamingMatcher
23
+ ...require("@stream-mdx/core/streaming/custom-matcher")
139
24
  });
140
25
  //# sourceMappingURL=custom-matcher.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/streaming/custom-matcher.ts"],"sourcesContent":["// Custom streaming regex matcher to replace problematic incr-regex-package\n\n/**\n * Custom streaming pattern matcher\n */\nexport class CustomStreamingMatcher {\n private pattern: RegExp;\n private buffer = \"\";\n private possibleMatches: PossibleMatch[] = [];\n\n constructor(pattern: RegExp) {\n this.pattern = pattern;\n }\n\n /**\n * Add character to buffer and check for matches\n */\n addCharacter(char: string): MatchResult {\n this.buffer += char;\n\n // Check for complete matches\n const fullMatch = this.buffer.match(this.pattern);\n if (fullMatch && fullMatch.index === 0) {\n const match = {\n matched: true,\n content: fullMatch[0],\n length: fullMatch[0].length,\n isComplete: true,\n };\n\n // Clean up buffer\n this.buffer = this.buffer.slice(fullMatch[0].length);\n this.possibleMatches = [];\n\n return match;\n }\n\n // Check for partial matches\n const confidence = this.calculatePartialConfidence();\n\n return {\n matched: false,\n content: this.buffer,\n length: this.buffer.length,\n isComplete: false,\n confidence,\n };\n }\n\n /**\n * Add string to buffer and check for matches\n */\n addString(str: string): MatchResult[] {\n const results: MatchResult[] = [];\n\n for (const char of str) {\n const result = this.addCharacter(char);\n if (result.matched) {\n results.push(result);\n }\n }\n\n // If no complete matches, return the final partial state\n if (results.length === 0 && this.buffer.length > 0) {\n results.push({\n matched: false,\n content: this.buffer,\n length: this.buffer.length,\n isComplete: false,\n confidence: this.calculatePartialConfidence(),\n });\n }\n\n return results;\n }\n\n /**\n * Check if current buffer could lead to a match\n */\n couldMatch(): boolean {\n if (this.buffer.length === 0) return true;\n\n // Create a test pattern that matches the start of our full pattern\n const patternSource = this.pattern.source;\n const flags = this.pattern.flags;\n\n try {\n // Create partial pattern by making the rest optional\n const partialPattern = new RegExp(`^${patternSource.replace(/\\$$/, \"\")}`, flags);\n const testString = this.buffer + \"X\".repeat(100); // Add potential completion\n return partialPattern.test(testString);\n } catch {\n // Fallback: check if buffer is a prefix of any potential match\n return this.isValidPrefix();\n }\n }\n\n /**\n * Reset the matcher\n */\n reset(): void {\n this.buffer = \"\";\n this.possibleMatches = [];\n }\n\n /**\n * Get current buffer content\n */\n getBuffer(): string {\n return this.buffer;\n }\n\n /**\n * Calculate confidence for partial matches\n */\n private calculatePartialConfidence(): number {\n if (this.buffer.length === 0) return 0;\n\n let confidence = 0.1; // Base confidence\n\n // Higher confidence for longer buffers\n confidence += Math.min(0.4, this.buffer.length * 0.1);\n\n // Higher confidence if buffer matches start of pattern\n if (this.couldMatch()) {\n confidence += 0.3;\n }\n\n // Special case for common patterns\n if (this.buffer.startsWith(\"$\")) confidence += 0.2;\n if (this.buffer.startsWith(\"$$\")) confidence += 0.3;\n\n return Math.min(1, confidence);\n }\n\n /**\n * Check if current buffer is a valid prefix\n */\n private isValidPrefix(): boolean {\n const patternStr = this.pattern.source;\n\n // Simple prefix checking for common patterns\n if (patternStr.includes(\"\\\\$\\\\$\") && (this.buffer === \"$\" || this.buffer === \"$$\")) {\n return true;\n }\n\n if (patternStr.includes(\"\\\\$\") && this.buffer === \"$\") {\n return true;\n }\n\n return false;\n }\n}\n\n/**\n * Result of streaming match attempt\n */\nexport interface MatchResult {\n /** Whether a complete match was found */\n matched: boolean;\n\n /** Content that was matched or current buffer */\n content: string;\n\n /** Length of match or buffer */\n length: number;\n\n /** Whether this is a complete match */\n isComplete: boolean;\n\n /** Confidence that this will become a match (0-1) */\n confidence?: number;\n}\n\n/**\n * Possible partial match tracking\n */\ninterface PossibleMatch {\n startIndex: number;\n pattern: RegExp;\n confidence: number;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,IAAM,yBAAN,MAA6B;AAAA,EAKlC,YAAY,SAAiB;AAH7B,SAAQ,SAAS;AACjB,SAAQ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B,IAAI,OAAO,IAAI,cAAc,QAAQ,OAAO,EAAE,CAAC,IAAI,KAAK;AAC/E,YAAM,aAAa,KAAK,SAAS,IAAI,OAAO,GAAG;AAC/C,aAAO,eAAe,KAAK,UAAU;AAAA,IACvC,QAAQ;AAEN,aAAO,KAAK,cAAc;AAAA,IAC5B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,QAAc;AACZ,SAAK,SAAS;AACd,SAAK,kBAAkB,CAAC;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA,EAKA,YAAoB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKQ,6BAAqC;AAC3C,QAAI,KAAK,OAAO,WAAW,EAAG,QAAO;AAErC,QAAI,aAAa;AAGjB,kBAAc,KAAK,IAAI,KAAK,KAAK,OAAO,SAAS,GAAG;AAGpD,QAAI,KAAK,WAAW,GAAG;AACrB,oBAAc;AAAA,IAChB;AAGA,QAAI,KAAK,OAAO,WAAW,GAAG,EAAG,eAAc;AAC/C,QAAI,KAAK,OAAO,WAAW,IAAI,EAAG,eAAc;AAEhD,WAAO,KAAK,IAAI,GAAG,UAAU;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA,EAKQ,gBAAyB;AAC/B,UAAM,aAAa,KAAK,QAAQ;AAGhC,QAAI,WAAW,SAAS,QAAQ,MAAM,KAAK,WAAW,OAAO,KAAK,WAAW,OAAO;AAClF,aAAO;AAAA,IACT;AAEA,QAAI,WAAW,SAAS,KAAK,KAAK,KAAK,WAAW,KAAK;AACrD,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/streaming/custom-matcher.ts"],"sourcesContent":["export * from \"@stream-mdx/core/streaming/custom-matcher\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,mCAAc,sDAAd;","names":[]}
@@ -1,54 +1 @@
1
- /**
2
- * Custom streaming pattern matcher
3
- */
4
- declare class CustomStreamingMatcher {
5
- private pattern;
6
- private buffer;
7
- private possibleMatches;
8
- constructor(pattern: RegExp);
9
- /**
10
- * Add character to buffer and check for matches
11
- */
12
- addCharacter(char: string): MatchResult;
13
- /**
14
- * Add string to buffer and check for matches
15
- */
16
- addString(str: string): MatchResult[];
17
- /**
18
- * Check if current buffer could lead to a match
19
- */
20
- couldMatch(): boolean;
21
- /**
22
- * Reset the matcher
23
- */
24
- reset(): void;
25
- /**
26
- * Get current buffer content
27
- */
28
- getBuffer(): string;
29
- /**
30
- * Calculate confidence for partial matches
31
- */
32
- private calculatePartialConfidence;
33
- /**
34
- * Check if current buffer is a valid prefix
35
- */
36
- private isValidPrefix;
37
- }
38
- /**
39
- * Result of streaming match attempt
40
- */
41
- interface MatchResult {
42
- /** Whether a complete match was found */
43
- matched: boolean;
44
- /** Content that was matched or current buffer */
45
- content: string;
46
- /** Length of match or buffer */
47
- length: number;
48
- /** Whether this is a complete match */
49
- isComplete: boolean;
50
- /** Confidence that this will become a match (0-1) */
51
- confidence?: number;
52
- }
53
-
54
- export { CustomStreamingMatcher, type MatchResult };
1
+ export * from '@stream-mdx/core/streaming/custom-matcher';
@@ -1,54 +1 @@
1
- /**
2
- * Custom streaming pattern matcher
3
- */
4
- declare class CustomStreamingMatcher {
5
- private pattern;
6
- private buffer;
7
- private possibleMatches;
8
- constructor(pattern: RegExp);
9
- /**
10
- * Add character to buffer and check for matches
11
- */
12
- addCharacter(char: string): MatchResult;
13
- /**
14
- * Add string to buffer and check for matches
15
- */
16
- addString(str: string): MatchResult[];
17
- /**
18
- * Check if current buffer could lead to a match
19
- */
20
- couldMatch(): boolean;
21
- /**
22
- * Reset the matcher
23
- */
24
- reset(): void;
25
- /**
26
- * Get current buffer content
27
- */
28
- getBuffer(): string;
29
- /**
30
- * Calculate confidence for partial matches
31
- */
32
- private calculatePartialConfidence;
33
- /**
34
- * Check if current buffer is a valid prefix
35
- */
36
- private isValidPrefix;
37
- }
38
- /**
39
- * Result of streaming match attempt
40
- */
41
- interface MatchResult {
42
- /** Whether a complete match was found */
43
- matched: boolean;
44
- /** Content that was matched or current buffer */
45
- content: string;
46
- /** Length of match or buffer */
47
- length: number;
48
- /** Whether this is a complete match */
49
- isComplete: boolean;
50
- /** Confidence that this will become a match (0-1) */
51
- confidence?: number;
52
- }
53
-
54
- export { CustomStreamingMatcher, type MatchResult };
1
+ export * from '@stream-mdx/core/streaming/custom-matcher';
@@ -1,115 +1,3 @@
1
1
  // src/streaming/custom-matcher.ts
2
- var CustomStreamingMatcher = class {
3
- constructor(pattern) {
4
- this.buffer = "";
5
- this.possibleMatches = [];
6
- this.pattern = pattern;
7
- }
8
- /**
9
- * Add character to buffer and check for matches
10
- */
11
- addCharacter(char) {
12
- this.buffer += char;
13
- const fullMatch = this.buffer.match(this.pattern);
14
- if (fullMatch && fullMatch.index === 0) {
15
- const match = {
16
- matched: true,
17
- content: fullMatch[0],
18
- length: fullMatch[0].length,
19
- isComplete: true
20
- };
21
- this.buffer = this.buffer.slice(fullMatch[0].length);
22
- this.possibleMatches = [];
23
- return match;
24
- }
25
- const confidence = this.calculatePartialConfidence();
26
- return {
27
- matched: false,
28
- content: this.buffer,
29
- length: this.buffer.length,
30
- isComplete: false,
31
- confidence
32
- };
33
- }
34
- /**
35
- * Add string to buffer and check for matches
36
- */
37
- addString(str) {
38
- const results = [];
39
- for (const char of str) {
40
- const result = this.addCharacter(char);
41
- if (result.matched) {
42
- results.push(result);
43
- }
44
- }
45
- if (results.length === 0 && this.buffer.length > 0) {
46
- results.push({
47
- matched: false,
48
- content: this.buffer,
49
- length: this.buffer.length,
50
- isComplete: false,
51
- confidence: this.calculatePartialConfidence()
52
- });
53
- }
54
- return results;
55
- }
56
- /**
57
- * Check if current buffer could lead to a match
58
- */
59
- couldMatch() {
60
- if (this.buffer.length === 0) return true;
61
- const patternSource = this.pattern.source;
62
- const flags = this.pattern.flags;
63
- try {
64
- const partialPattern = new RegExp(`^${patternSource.replace(/\$$/, "")}`, flags);
65
- const testString = this.buffer + "X".repeat(100);
66
- return partialPattern.test(testString);
67
- } catch {
68
- return this.isValidPrefix();
69
- }
70
- }
71
- /**
72
- * Reset the matcher
73
- */
74
- reset() {
75
- this.buffer = "";
76
- this.possibleMatches = [];
77
- }
78
- /**
79
- * Get current buffer content
80
- */
81
- getBuffer() {
82
- return this.buffer;
83
- }
84
- /**
85
- * Calculate confidence for partial matches
86
- */
87
- calculatePartialConfidence() {
88
- if (this.buffer.length === 0) return 0;
89
- let confidence = 0.1;
90
- confidence += Math.min(0.4, this.buffer.length * 0.1);
91
- if (this.couldMatch()) {
92
- confidence += 0.3;
93
- }
94
- if (this.buffer.startsWith("$")) confidence += 0.2;
95
- if (this.buffer.startsWith("$$")) confidence += 0.3;
96
- return Math.min(1, confidence);
97
- }
98
- /**
99
- * Check if current buffer is a valid prefix
100
- */
101
- isValidPrefix() {
102
- const patternStr = this.pattern.source;
103
- if (patternStr.includes("\\$\\$") && (this.buffer === "$" || this.buffer === "$$")) {
104
- return true;
105
- }
106
- if (patternStr.includes("\\$") && this.buffer === "$") {
107
- return true;
108
- }
109
- return false;
110
- }
111
- };
112
- export {
113
- CustomStreamingMatcher
114
- };
2
+ export * from "@stream-mdx/core/streaming/custom-matcher";
115
3
  //# sourceMappingURL=custom-matcher.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/streaming/custom-matcher.ts"],"sourcesContent":["// Custom streaming regex matcher to replace problematic incr-regex-package\n\n/**\n * Custom streaming pattern matcher\n */\nexport class CustomStreamingMatcher {\n private pattern: RegExp;\n private buffer = \"\";\n private possibleMatches: PossibleMatch[] = [];\n\n constructor(pattern: RegExp) {\n this.pattern = pattern;\n }\n\n /**\n * Add character to buffer and check for matches\n */\n addCharacter(char: string): MatchResult {\n this.buffer += char;\n\n // Check for complete matches\n const fullMatch = this.buffer.match(this.pattern);\n if (fullMatch && fullMatch.index === 0) {\n const match = {\n matched: true,\n content: fullMatch[0],\n length: fullMatch[0].length,\n isComplete: true,\n };\n\n // Clean up buffer\n this.buffer = this.buffer.slice(fullMatch[0].length);\n this.possibleMatches = [];\n\n return match;\n }\n\n // Check for partial matches\n const confidence = this.calculatePartialConfidence();\n\n return {\n matched: false,\n content: this.buffer,\n length: this.buffer.length,\n isComplete: false,\n confidence,\n };\n }\n\n /**\n * Add string to buffer and check for matches\n */\n addString(str: string): MatchResult[] {\n const results: MatchResult[] = [];\n\n for (const char of str) {\n const result = this.addCharacter(char);\n if (result.matched) {\n results.push(result);\n }\n }\n\n // If no complete matches, return the final partial state\n if (results.length === 0 && this.buffer.length > 0) {\n results.push({\n matched: false,\n content: this.buffer,\n length: this.buffer.length,\n isComplete: false,\n confidence: this.calculatePartialConfidence(),\n });\n }\n\n return results;\n }\n\n /**\n * Check if current buffer could lead to a match\n */\n couldMatch(): boolean {\n if (this.buffer.length === 0) return true;\n\n // Create a test pattern that matches the start of our full pattern\n const patternSource = this.pattern.source;\n const flags = this.pattern.flags;\n\n try {\n // Create partial pattern by making the rest optional\n const partialPattern = new RegExp(`^${patternSource.replace(/\\$$/, \"\")}`, flags);\n const testString = this.buffer + \"X\".repeat(100); // Add potential completion\n return partialPattern.test(testString);\n } catch {\n // Fallback: check if buffer is a prefix of any potential match\n return this.isValidPrefix();\n }\n }\n\n /**\n * Reset the matcher\n */\n reset(): void {\n this.buffer = \"\";\n this.possibleMatches = [];\n }\n\n /**\n * Get current buffer content\n */\n getBuffer(): string {\n return this.buffer;\n }\n\n /**\n * Calculate confidence for partial matches\n */\n private calculatePartialConfidence(): number {\n if (this.buffer.length === 0) return 0;\n\n let confidence = 0.1; // Base confidence\n\n // Higher confidence for longer buffers\n confidence += Math.min(0.4, this.buffer.length * 0.1);\n\n // Higher confidence if buffer matches start of pattern\n if (this.couldMatch()) {\n confidence += 0.3;\n }\n\n // Special case for common patterns\n if (this.buffer.startsWith(\"$\")) confidence += 0.2;\n if (this.buffer.startsWith(\"$$\")) confidence += 0.3;\n\n return Math.min(1, confidence);\n }\n\n /**\n * Check if current buffer is a valid prefix\n */\n private isValidPrefix(): boolean {\n const patternStr = this.pattern.source;\n\n // Simple prefix checking for common patterns\n if (patternStr.includes(\"\\\\$\\\\$\") && (this.buffer === \"$\" || this.buffer === \"$$\")) {\n return true;\n }\n\n if (patternStr.includes(\"\\\\$\") && this.buffer === \"$\") {\n return true;\n }\n\n return false;\n }\n}\n\n/**\n * Result of streaming match attempt\n */\nexport interface MatchResult {\n /** Whether a complete match was found */\n matched: boolean;\n\n /** Content that was matched or current buffer */\n content: string;\n\n /** Length of match or buffer */\n length: number;\n\n /** Whether this is a complete match */\n isComplete: boolean;\n\n /** Confidence that this will become a match (0-1) */\n confidence?: number;\n}\n\n/**\n * Possible partial match tracking\n */\ninterface PossibleMatch {\n startIndex: number;\n pattern: RegExp;\n confidence: number;\n}\n"],"mappings":";AAKO,IAAM,yBAAN,MAA6B;AAAA,EAKlC,YAAY,SAAiB;AAH7B,SAAQ,SAAS;AACjB,SAAQ,kBAAmC,CAAC;AAG1C,SAAK,UAAU;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA,EAKA,aAAa,MAA2B;AACtC,SAAK,UAAU;AAGf,UAAM,YAAY,KAAK,OAAO,MAAM,KAAK,OAAO;AAChD,QAAI,aAAa,UAAU,UAAU,GAAG;AACtC,YAAM,QAAQ;AAAA,QACZ,SAAS;AAAA,QACT,SAAS,UAAU,CAAC;AAAA,QACpB,QAAQ,UAAU,CAAC,EAAE;AAAA,QACrB,YAAY;AAAA,MACd;AAGA,WAAK,SAAS,KAAK,OAAO,MAAM,UAAU,CAAC,EAAE,MAAM;AACnD,WAAK,kBAAkB,CAAC;AAExB,aAAO;AAAA,IACT;AAGA,UAAM,aAAa,KAAK,2BAA2B;AAEnD,WAAO;AAAA,MACL,SAAS;AAAA,MACT,SAAS,KAAK;AAAA,MACd,QAAQ,KAAK,OAAO;AAAA,MACpB,YAAY;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU,KA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QAAI,KAAK,OAAO,WAAW,IAAI,EAAG,eAAc;AAEhD,WAAO,KAAK,IAAI,GAAG,UAAU;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA,EAKQ,gBAAyB;AAC/B,UAAM,aAAa,KAAK,QAAQ;AAGhC,QAAI,WAAW,SAAS,QAAQ,MAAM,KAAK,WAAW,OAAO,KAAK,WAAW,OAAO;AAClF,aAAO;AAAA,IACT;AAEA,QAAI,WAAW,SAAS,KAAK,KAAK,KAAK,WAAW,KAAK;AACrD,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/streaming/custom-matcher.ts"],"sourcesContent":["export * from \"@stream-mdx/core/streaming/custom-matcher\";\n"],"mappings":";AAAA,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-mdx/worker",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "description": "Worker client utilities and shared worker helpers for the Streaming Markdown V2 pipeline",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,8 +32,12 @@
32
32
  "require": "./dist/streaming/custom-matcher.cjs"
33
33
  }
34
34
  },
35
- "files": ["dist"],
36
- "sideEffects": ["src/worker-dom-stub.ts"],
35
+ "files": [
36
+ "dist"
37
+ ],
38
+ "sideEffects": [
39
+ "src/worker-dom-stub.ts"
40
+ ],
37
41
  "scripts": {
38
42
  "build": "tsup",
39
43
  "build:hosted": "tsup --config tsup.hosted-worker.config.ts",
@@ -42,14 +46,16 @@
42
46
  "prepack": "npm run build && npm run build:hosted"
43
47
  },
44
48
  "dependencies": {
49
+ "@lezer/common": "^1.2.3",
45
50
  "@lezer/lr": "^1.4.2",
46
51
  "@lezer/markdown": "^1.3.0",
47
- "@stream-mdx/core": "0.0.0",
48
- "@stream-mdx/plugins": "0.0.0",
52
+ "@stream-mdx/core": "0.0.1",
53
+ "@stream-mdx/plugins": "0.0.1",
49
54
  "@mdx-js/mdx": "^3.1.0",
50
55
  "@shikijs/engine-javascript": "^1.29.2",
51
56
  "@shikijs/engine-oniguruma": "^1.29.2",
52
57
  "character-entities": "^2.0.2",
58
+ "rehype-katex": "^7.0.1",
53
59
  "rehype-slug": "^6.0.0",
54
60
  "remark-gfm": "^4.0.0",
55
61
  "remark-math": "^6.0.0",