json-brook 0.1.0-alpha.2 → 0.1.0-alpha.4
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/index.js +46 -46
- package/dist/index.umd.cjs +2 -2
- package/dist/parse.d.ts +12 -12
- package/dist/tokenize.d.ts +9 -9
- package/package.json +61 -60
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const O = (e) => {
|
|
|
13
13
|
);
|
|
14
14
|
}
|
|
15
15
|
return e.value;
|
|
16
|
-
}, j = (e) => e.children.map((t) => w(t)),
|
|
16
|
+
}, j = (e) => e.children.map((t) => w(t)), D = (e) => e.children.reduce(
|
|
17
17
|
(t, r) => (r.value && (t[r.key.value] = w(r.value)), t),
|
|
18
18
|
{}
|
|
19
19
|
), w = (e) => {
|
|
@@ -23,33 +23,33 @@ const O = (e) => {
|
|
|
23
23
|
case "array":
|
|
24
24
|
return j(e);
|
|
25
25
|
case "object":
|
|
26
|
-
return
|
|
26
|
+
return D(e);
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, P = (e) => {
|
|
29
29
|
if (e.value)
|
|
30
30
|
return w(e.value);
|
|
31
|
-
},
|
|
31
|
+
}, C = (e) => P(e.getRoot()), z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
32
32
|
__proto__: null,
|
|
33
|
-
simpleGenerator:
|
|
33
|
+
simpleGenerator: C
|
|
34
34
|
}, Symbol.toStringTag, { value: "Module" })), p = {
|
|
35
|
-
Normal:
|
|
36
|
-
Escape:
|
|
35
|
+
Normal: "Normal",
|
|
36
|
+
Escape: "Escape"
|
|
37
37
|
}, a = {
|
|
38
|
-
Negative:
|
|
39
|
-
Zero:
|
|
40
|
-
Digit:
|
|
41
|
-
Point:
|
|
42
|
-
DigitFraction:
|
|
43
|
-
Exp:
|
|
44
|
-
ExpDigitOrSign:
|
|
45
|
-
},
|
|
46
|
-
`, "\r"],
|
|
47
|
-
if (
|
|
38
|
+
Negative: "Negative",
|
|
39
|
+
Zero: "Zero",
|
|
40
|
+
Digit: "Digit",
|
|
41
|
+
Point: "Point",
|
|
42
|
+
DigitFraction: "DigitFraction",
|
|
43
|
+
Exp: "Exp",
|
|
44
|
+
ExpDigitOrSign: "ExpDigitOrSign"
|
|
45
|
+
}, V = [" ", " ", `
|
|
46
|
+
`, "\r"], _ = ["{", "}", "[", "]", ":", ","], g = ["true", "false", "null"], J = g.map((e) => e[0]), G = ['"', "\\", "/", "b", "f", "n", "r", "t"], K = ["+", "-"], c = (e) => e >= "0" && e <= "9", E = (e) => e >= "1" && e <= "9", Z = (e) => c(e) || e >= "a" && e <= "f" || e >= "A" && e <= "F", k = (e) => e === "e" || e === "E", o = (e) => {
|
|
47
|
+
if (V.includes(e))
|
|
48
48
|
return {
|
|
49
49
|
token: null,
|
|
50
50
|
current: null
|
|
51
51
|
};
|
|
52
|
-
if (
|
|
52
|
+
if (_.includes(e))
|
|
53
53
|
return {
|
|
54
54
|
token: {
|
|
55
55
|
type: "symbol",
|
|
@@ -97,7 +97,7 @@ const O = (e) => {
|
|
|
97
97
|
validLength: 1
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
if (
|
|
100
|
+
if (E(e))
|
|
101
101
|
return {
|
|
102
102
|
token: null,
|
|
103
103
|
current: {
|
|
@@ -108,7 +108,7 @@ const O = (e) => {
|
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
throw new Error("解析失败");
|
|
111
|
-
},
|
|
111
|
+
}, h = (e, t) => {
|
|
112
112
|
if (e === t.value[t.matchLength])
|
|
113
113
|
return t.matchLength++, t.matchLength === t.value.length ? {
|
|
114
114
|
token: {
|
|
@@ -176,7 +176,7 @@ const O = (e) => {
|
|
|
176
176
|
token: null,
|
|
177
177
|
current: t
|
|
178
178
|
};
|
|
179
|
-
if (
|
|
179
|
+
if (E(e))
|
|
180
180
|
return t.state = a.Digit, t.value += e, t.validLength = t.value.length, {
|
|
181
181
|
token: null,
|
|
182
182
|
current: t
|
|
@@ -266,37 +266,37 @@ const O = (e) => {
|
|
|
266
266
|
};
|
|
267
267
|
throw new Error("解析失败");
|
|
268
268
|
}
|
|
269
|
-
},
|
|
269
|
+
}, S = (e) => {
|
|
270
270
|
if (e.validLength === e.value.length)
|
|
271
271
|
return {
|
|
272
272
|
type: "number",
|
|
273
273
|
value: JSON.parse(e.value)
|
|
274
274
|
};
|
|
275
275
|
throw new Error("解析失败");
|
|
276
|
-
},
|
|
276
|
+
}, A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
277
277
|
__proto__: null,
|
|
278
278
|
NumberTokenState: a,
|
|
279
279
|
StringTokenState: p,
|
|
280
|
-
endNumberTokenCurrent:
|
|
280
|
+
endNumberTokenCurrent: S,
|
|
281
281
|
parseNextToken: o,
|
|
282
|
-
parseNextTokenWithKeyword:
|
|
282
|
+
parseNextTokenWithKeyword: h,
|
|
283
283
|
parseNextTokenWithNumber: m,
|
|
284
284
|
parseNextTokenWithString: y
|
|
285
285
|
}, Symbol.toStringTag, { value: "Module" })), l = {
|
|
286
|
-
Start:
|
|
287
|
-
Value:
|
|
288
|
-
Comma:
|
|
289
|
-
End:
|
|
286
|
+
Start: "Start",
|
|
287
|
+
Value: "Value",
|
|
288
|
+
Comma: "Comma",
|
|
289
|
+
End: "End"
|
|
290
290
|
}, u = {
|
|
291
|
-
Key:
|
|
292
|
-
Colon:
|
|
293
|
-
Value:
|
|
294
|
-
End:
|
|
291
|
+
Key: "Key",
|
|
292
|
+
Colon: "Colon",
|
|
293
|
+
Value: "Value",
|
|
294
|
+
End: "End"
|
|
295
295
|
}, s = {
|
|
296
|
-
Start:
|
|
297
|
-
Property:
|
|
298
|
-
Comma:
|
|
299
|
-
End:
|
|
296
|
+
Start: "Start",
|
|
297
|
+
Property: "Property",
|
|
298
|
+
Comma: "Comma",
|
|
299
|
+
End: "End"
|
|
300
300
|
}, i = (e, t) => {
|
|
301
301
|
switch (e.type) {
|
|
302
302
|
case "root":
|
|
@@ -312,7 +312,7 @@ const O = (e) => {
|
|
|
312
312
|
return e.state = u.End, e.parent;
|
|
313
313
|
throw new Error("解析失败");
|
|
314
314
|
}
|
|
315
|
-
},
|
|
315
|
+
}, b = (e, t) => {
|
|
316
316
|
if (!e.value) {
|
|
317
317
|
const r = o(t);
|
|
318
318
|
if (r.current)
|
|
@@ -346,7 +346,7 @@ const O = (e) => {
|
|
|
346
346
|
if (e.current)
|
|
347
347
|
switch (e.current.type) {
|
|
348
348
|
case "keyword": {
|
|
349
|
-
const r =
|
|
349
|
+
const r = h(t, e.current);
|
|
350
350
|
return r.token ? (e.value = r.token.value, e.current = null, i(e.parent)) : (e.current = r.current, e);
|
|
351
351
|
}
|
|
352
352
|
case "string": {
|
|
@@ -584,13 +584,13 @@ const O = (e) => {
|
|
|
584
584
|
case s.End:
|
|
585
585
|
throw new Error("解析失败");
|
|
586
586
|
}
|
|
587
|
-
},
|
|
587
|
+
}, F = (e) => {
|
|
588
588
|
switch (e.type) {
|
|
589
589
|
case "root":
|
|
590
590
|
return e;
|
|
591
591
|
case "literal":
|
|
592
592
|
if (e.current && e.current.type === "number") {
|
|
593
|
-
const t =
|
|
593
|
+
const t = S(e.current);
|
|
594
594
|
return e.value = t.value, e.current = null, i(e.parent);
|
|
595
595
|
}
|
|
596
596
|
throw new Error("解析失败");
|
|
@@ -605,13 +605,13 @@ const O = (e) => {
|
|
|
605
605
|
ArrayNodeState: l,
|
|
606
606
|
ObjectNodeState: s,
|
|
607
607
|
PropertyNodeState: u,
|
|
608
|
-
endAst:
|
|
608
|
+
endAst: F,
|
|
609
609
|
parseArrayNode: f,
|
|
610
610
|
parseIdentifierNode: x,
|
|
611
611
|
parseLiteralNode: N,
|
|
612
612
|
parseObjectNode: T,
|
|
613
613
|
parsePropertyNode: L,
|
|
614
|
-
parseRootNode:
|
|
614
|
+
parseRootNode: b
|
|
615
615
|
}, Symbol.toStringTag, { value: "Module" })), R = () => {
|
|
616
616
|
const e = {
|
|
617
617
|
type: "root",
|
|
@@ -624,7 +624,7 @@ const O = (e) => {
|
|
|
624
624
|
parse: (r) => {
|
|
625
625
|
switch (t.type) {
|
|
626
626
|
case "root":
|
|
627
|
-
t =
|
|
627
|
+
t = b(t, r);
|
|
628
628
|
break;
|
|
629
629
|
case "literal":
|
|
630
630
|
t = N(t, r);
|
|
@@ -647,7 +647,7 @@ const O = (e) => {
|
|
|
647
647
|
};
|
|
648
648
|
export {
|
|
649
649
|
R as createJsonBrook,
|
|
650
|
-
|
|
650
|
+
z as generate,
|
|
651
651
|
M as parse,
|
|
652
|
-
|
|
652
|
+
A as tokenize
|
|
653
653
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(i,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(i=typeof globalThis<"u"?globalThis:i||self,k(i.JsonBrook={}))})(this,(function(i){"use strict";const k=e=>{if(e.current)switch(e.current.type){case"keyword":return e.current.value;case"string":return JSON.parse(e.current.escapeLength>0?e.current.value.slice(0,-e.current.escapeLength):e.current.value);case"number":return JSON.parse(e.current.value.slice(0,e.current.validLength))}return e.value},P=e=>e.children.map(t=>w(t)),D=e=>e.children.reduce((t,r)=>(r.value&&(t[r.key.value]=w(r.value)),t),{}),w=e=>{switch(e.type){case"literal":return k(e);case"array":return P(e);case"object":return D(e)}},
|
|
2
|
-
`,"\r"],
|
|
1
|
+
(function(i,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(i=typeof globalThis<"u"?globalThis:i||self,k(i.JsonBrook={}))})(this,(function(i){"use strict";const k=e=>{if(e.current)switch(e.current.type){case"keyword":return e.current.value;case"string":return JSON.parse(e.current.escapeLength>0?e.current.value.slice(0,-e.current.escapeLength):e.current.value);case"number":return JSON.parse(e.current.value.slice(0,e.current.validLength))}return e.value},P=e=>e.children.map(t=>w(t)),D=e=>e.children.reduce((t,r)=>(r.value&&(t[r.key.value]=w(r.value)),t),{}),w=e=>{switch(e.type){case"literal":return k(e);case"array":return P(e);case"object":return D(e)}},C=e=>{if(e.value)return w(e.value)},V=Object.freeze(Object.defineProperty({__proto__:null,simpleGenerator:e=>C(e.getRoot())},Symbol.toStringTag,{value:"Module"})),c={Normal:"Normal",Escape:"Escape"},a={Negative:"Negative",Zero:"Zero",Digit:"Digit",Point:"Point",DigitFraction:"DigitFraction",Exp:"Exp",ExpDigitOrSign:"ExpDigitOrSign"},_=[" "," ",`
|
|
2
|
+
`,"\r"],J=["{","}","[","]",":",","],E=["true","false","null"],d=E.map(e=>e[0]),G=['"',"\\","/","b","f","n","r","t"],K=["+","-"],v=e=>e>="0"&&e<="9",m=e=>e>="1"&&e<="9",Z=e=>v(e)||e>="a"&&e<="f"||e>="A"&&e<="F",y=e=>e==="e"||e==="E",o=e=>{if(_.includes(e))return{token:null,current:null};if(J.includes(e))return{token:{type:"symbol",value:e},current:null};const t=d.indexOf(e);if(t!==-1)return{token:null,current:{type:"keyword",value:E[t],matchLength:1}};if(e==='"')return{token:null,current:{type:"string",state:c.Normal,value:e,escapeLength:0}};if(e==="-")return{token:null,current:{type:"number",state:a.Negative,value:e,validLength:0}};if(e==="0")return{token:null,current:{type:"number",state:a.Zero,value:e,validLength:1}};if(m(e))return{token:null,current:{type:"number",state:a.Digit,value:e,validLength:1}};throw new Error("解析失败")},S=(e,t)=>{if(e===t.value[t.matchLength])return t.matchLength++,t.matchLength===t.value.length?{token:{type:"keyword",value:JSON.parse(t.value)},current:null}:{token:null,current:t};throw new Error("解析失败")},g=(e,t)=>{switch(t.state){case c.Normal:switch(e){case'"':return t.value+=e,{token:{type:"string",value:t.value},current:null};case"\\":return t.state=c.Escape,t.value+=e,t.escapeLength=1,{token:null,current:t};default:return t.value+=e,{token:null,current:t}}case c.Escape:if(t.escapeLength===1){if(G.includes(e))return t.state=c.Normal,t.value+=e,t.escapeLength=0,{token:null,current:t};if(e==="u")return t.value+=e,t.escapeLength++,{token:null,current:t};throw new Error("解析失败")}if(Z(e))return t.escapeLength===6?(t.state=c.Normal,t.value+=e,t.escapeLength=0,{token:null,current:t}):(t.value+=e,t.escapeLength++,{token:null,current:t});throw new Error("解析失败")}},b=(e,t)=>{switch(t.state){case a.Negative:if(e==="0")return t.state=a.Zero,t.value+=e,t.validLength=t.value.length,{token:null,current:t};if(m(e))return t.state=a.Digit,t.value+=e,t.validLength=t.value.length,{token:null,current:t};throw new Error("解析失败");case a.Zero:return e==="."?(t.state=a.Point,t.value+=e,{token:null,current:t}):y(e)?(t.state=a.Exp,t.value+=e,{token:null,current:t}):{token:{type:"number",value:JSON.parse(t.value)},current:null,char:e};case a.Digit:return v(e)?(t.value+=e,t.validLength=t.value.length,{token:null,current:t}):e==="."?(t.state=a.Point,t.value+=e,{token:null,current:t}):y(e)?(t.state=a.Exp,t.value+=e,{token:null,current:t}):{token:{type:"number",value:JSON.parse(t.value)},current:null,char:e};case a.Point:if(v(e))return t.state=a.DigitFraction,t.value+=e,t.validLength=t.value.length,{token:null,current:t};throw new Error("解析失败");case a.DigitFraction:return v(e)?(t.value+=e,t.validLength=t.value.length,{token:null,current:t}):y(e)?(t.state=a.Exp,t.value+=e,{token:null,current:t}):{token:{type:"number",value:JSON.parse(t.value)},current:null,char:e};case a.Exp:if(K.includes(e))return t.state=a.ExpDigitOrSign,t.value+=e,{token:null,current:t};if(v(e))return t.state=a.ExpDigitOrSign,t.value+=e,t.validLength=t.value.length,{token:null,current:t};throw new Error("解析失败");case a.ExpDigitOrSign:if(v(e))return t.value+=e,t.validLength=t.value.length,{token:null,current:t};if(t.validLength===t.value.length)return{token:{type:"number",value:JSON.parse(t.value)},current:null,char:e};throw new Error("解析失败")}},N=e=>{if(e.validLength===e.value.length)return{type:"number",value:JSON.parse(e.value)};throw new Error("解析失败")},z=Object.freeze(Object.defineProperty({__proto__:null,NumberTokenState:a,StringTokenState:c,endNumberTokenCurrent:N,parseNextToken:o,parseNextTokenWithKeyword:S,parseNextTokenWithNumber:b,parseNextTokenWithString:g},Symbol.toStringTag,{value:"Module"})),l={Start:"Start",Value:"Value",Comma:"Comma",End:"End"},u={Key:"Key",Colon:"Colon",Value:"Value",End:"End"},s={Start:"Start",Property:"Property",Comma:"Comma",End:"End"},p=(e,t)=>{switch(e.type){case"root":if(t)throw new Error("解析失败");return e;case"array":if(e.state===l.Value)return t?h(e,t):e;throw new Error("解析失败");case"property":if(e.state===u.Value)return e.state=u.End,e.parent;throw new Error("解析失败")}},x=(e,t)=>{if(!e.value){const r=o(t);if(r.current)return e.value={type:"literal",value:null,current:r.current,parent:e},e.value;if(!r.token)return e;switch(r.token.value){case"[":return e.value={type:"array",state:l.Start,children:[],parent:e},e.value;case"{":return e.value={type:"object",state:s.Start,children:[],parent:e},e.value}}throw new Error("解析失败")},L=(e,t)=>{if(e.current)switch(e.current.type){case"keyword":{const r=S(t,e.current);return r.token?(e.value=r.token.value,e.current=null,p(e.parent)):(e.current=r.current,e)}case"string":{const r=g(t,e.current);return r.token?(e.value=r.token.value,e.current=null,p(e.parent)):(e.current=r.current,e)}case"number":{const r=b(t,e.current);return r.token?(e.value=r.token.value,e.current=null,p(e.parent,r.char)):(e.current=r.current,e)}}throw new Error("解析失败")},h=(e,t)=>{switch(e.state){case l.Start:{const r=o(t);if(r.current){e.state=l.Value;const n={type:"literal",value:null,current:r.current,parent:e};return e.children.push(n),n}if(!r.token)return e;switch(r.token.value){case"]":return e.state=l.End,p(e.parent);case"[":{e.state=l.Value;const n={type:"array",state:l.Start,children:[],parent:e};return e.children.push(n),n}case"{":{e.state=l.Start;const n={type:"object",state:s.Start,children:[],parent:e};return e.children.push(n),n}}throw new Error("解析失败")}case l.Comma:{const r=o(t);if(r.current){e.state=l.Value;const n={type:"literal",value:null,current:r.current,parent:e};return e.children.push(n),n}if(!r.token)return e;switch(r.token.value){case"[":{e.state=l.Value;const n={type:"array",state:l.Start,children:[],parent:e};return e.children.push(n),n}case"{":{e.state=l.Start;const n={type:"object",state:s.Start,children:[],parent:e};return e.children.push(n),n}}throw new Error("解析失败")}case l.Value:{const r=o(t);if(r.current)throw new Error("解析失败");if(!r.token)return e;switch(r.token.value){case",":return e.state=l.Comma,e;case"]":return e.state=l.End,p(e.parent)}throw new Error("解析失败")}case l.End:throw new Error("解析失败")}},T=(e,t)=>{if(e.current){const r=g(t,e.current);return r.current?(e.current=r.current,e):(e.value=r.token.value,e.current=null,e.parent.state=u.Colon,e.parent)}throw new Error("解析失败")},O=(e,t)=>{switch(e.state){case u.Colon:{const r=o(t);if(r.current)throw new Error("解析失败");if(!r.token)return e;if(r.token.value===":")return e.state=u.Value,e;throw new Error("解析失败")}case u.Value:{const r=o(t);if(r.current){const n={type:"literal",value:null,current:r.current,parent:e};return e.value=n,n}if(!r.token)return e;switch(r.token.value){case"[":{const n={type:"array",state:l.Start,children:[],parent:e};return e.value=n,n}case"{":{const n={type:"object",state:s.Start,children:[],parent:e};return e.value=n,n}}throw new Error("解析失败")}case u.Key:case u.End:throw new Error("解析失败")}},j=(e,t)=>{switch(e.state){case s.Start:{const r=o(t);if(r.current){if(r.current.type==="string"){e.state=s.Property;const n={type:"property",state:u.Key,key:null,value:null,parent:e},f={type:"identifier",value:"",current:r.current,parent:n};return n.key=f,e.children.push(n),f}throw new Error("解析失败")}if(!r.token)return e;if(r.token.value==="}")return e.state=s.End,p(e.parent);throw new Error("解析失败")}case s.Comma:{const r=o(t);if(r.current){if(r.current.type==="string"){e.state=s.Property;const n={type:"property",state:u.Key,key:null,value:null,parent:e},f={type:"identifier",value:"",current:r.current,parent:n};return n.key=f,e.children.push(n),f}throw new Error("解析失败")}if(!r.token)return e;throw new Error("解析失败")}case s.Property:{const r=o(t);if(r.current)throw new Error("解析失败");if(!r.token)return e;switch(r.token.value){case",":return e.state=s.Comma,e;case"}":return e.state=s.End,p(e.parent)}throw new Error("解析失败")}case s.End:throw new Error("解析失败")}},A=Object.freeze(Object.defineProperty({__proto__:null,ArrayNodeState:l,ObjectNodeState:s,PropertyNodeState:u,endAst:e=>{switch(e.type){case"root":return e;case"literal":if(e.current&&e.current.type==="number"){const t=N(e.current);return e.value=t.value,e.current=null,p(e.parent)}throw new Error("解析失败");case"array":case"object":case"property":case"identifier":throw new Error("解析失败")}},parseArrayNode:h,parseIdentifierNode:T,parseLiteralNode:L,parseObjectNode:j,parsePropertyNode:O,parseRootNode:x},Symbol.toStringTag,{value:"Module"})),F=()=>{const e={type:"root",value:null};let t=e;return{getRoot:()=>e,getCurrent:()=>t,parse:r=>{switch(t.type){case"root":t=x(t,r);break;case"literal":t=L(t,r);break;case"array":t=h(t,r);break;case"identifier":t=T(t,r);break;case"property":t=O(t,r);break;case"object":t=j(t,r);break}}}};i.createJsonBrook=F,i.generate=V,i.parse=A,i.tokenize=z,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/parse.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export type LiteralNode = {
|
|
|
10
10
|
parent: RootNode | ArrayNode | PropertyNode;
|
|
11
11
|
};
|
|
12
12
|
export declare const ArrayNodeState: {
|
|
13
|
-
readonly Start:
|
|
14
|
-
readonly Value:
|
|
15
|
-
readonly Comma:
|
|
16
|
-
readonly End:
|
|
13
|
+
readonly Start: "Start";
|
|
14
|
+
readonly Value: "Value";
|
|
15
|
+
readonly Comma: "Comma";
|
|
16
|
+
readonly End: "End";
|
|
17
17
|
};
|
|
18
18
|
export type ArrayNodeState = (typeof ArrayNodeState)[keyof typeof ArrayNodeState];
|
|
19
19
|
export type ArrayNode = {
|
|
@@ -29,10 +29,10 @@ export type IdentifierNode = {
|
|
|
29
29
|
parent: PropertyNode;
|
|
30
30
|
};
|
|
31
31
|
export declare const PropertyNodeState: {
|
|
32
|
-
readonly Key:
|
|
33
|
-
readonly Colon:
|
|
34
|
-
readonly Value:
|
|
35
|
-
readonly End:
|
|
32
|
+
readonly Key: "Key";
|
|
33
|
+
readonly Colon: "Colon";
|
|
34
|
+
readonly Value: "Value";
|
|
35
|
+
readonly End: "End";
|
|
36
36
|
};
|
|
37
37
|
export type PropertyNodeState = (typeof PropertyNodeState)[keyof typeof PropertyNodeState];
|
|
38
38
|
export type PropertyNode = {
|
|
@@ -43,10 +43,10 @@ export type PropertyNode = {
|
|
|
43
43
|
parent: ObjectNode;
|
|
44
44
|
};
|
|
45
45
|
export declare const ObjectNodeState: {
|
|
46
|
-
readonly Start:
|
|
47
|
-
readonly Property:
|
|
48
|
-
readonly Comma:
|
|
49
|
-
readonly End:
|
|
46
|
+
readonly Start: "Start";
|
|
47
|
+
readonly Property: "Property";
|
|
48
|
+
readonly Comma: "Comma";
|
|
49
|
+
readonly End: "End";
|
|
50
50
|
};
|
|
51
51
|
export type ObjectNodeState = (typeof ObjectNodeState)[keyof typeof ObjectNodeState];
|
|
52
52
|
export type ObjectNode = {
|
package/dist/tokenize.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export type KeywordTokenCurrent = {
|
|
|
14
14
|
matchLength: number;
|
|
15
15
|
};
|
|
16
16
|
export declare const StringTokenState: {
|
|
17
|
-
readonly Normal:
|
|
18
|
-
readonly Escape:
|
|
17
|
+
readonly Normal: "Normal";
|
|
18
|
+
readonly Escape: "Escape";
|
|
19
19
|
};
|
|
20
20
|
export type StringTokenState = (typeof StringTokenState)[keyof typeof StringTokenState];
|
|
21
21
|
export type StringToken = {
|
|
@@ -29,13 +29,13 @@ export type StringTokenCurrent = {
|
|
|
29
29
|
escapeLength: number;
|
|
30
30
|
};
|
|
31
31
|
export declare const NumberTokenState: {
|
|
32
|
-
readonly Negative:
|
|
33
|
-
readonly Zero:
|
|
34
|
-
readonly Digit:
|
|
35
|
-
readonly Point:
|
|
36
|
-
readonly DigitFraction:
|
|
37
|
-
readonly Exp:
|
|
38
|
-
readonly ExpDigitOrSign:
|
|
32
|
+
readonly Negative: "Negative";
|
|
33
|
+
readonly Zero: "Zero";
|
|
34
|
+
readonly Digit: "Digit";
|
|
35
|
+
readonly Point: "Point";
|
|
36
|
+
readonly DigitFraction: "DigitFraction";
|
|
37
|
+
readonly Exp: "Exp";
|
|
38
|
+
readonly ExpDigitOrSign: "ExpDigitOrSign";
|
|
39
39
|
};
|
|
40
40
|
export type NumberTokenState = (typeof NumberTokenState)[keyof typeof NumberTokenState];
|
|
41
41
|
export type NumberToken = {
|
package/package.json
CHANGED
|
@@ -1,61 +1,62 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
2
|
+
"name": "json-brook",
|
|
3
|
+
"version": "0.1.0-alpha.4",
|
|
4
|
+
"description": "parse json data streamly",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"json",
|
|
7
|
+
"stream"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/asurance/json-brook",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/asurance/json-brook/issues"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "asurance",
|
|
15
|
+
"sideEffects": [],
|
|
16
|
+
"type": "module",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"CHANGELOG.md"
|
|
20
|
+
],
|
|
21
|
+
"main": "./dist/index.umd.cjs",
|
|
22
|
+
"module": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"import": "./dist/index.js",
|
|
27
|
+
"require": "./dist/index.umd.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"simple-git-hooks": {
|
|
31
|
+
"pre-commit": "npx lint-staged"
|
|
32
|
+
},
|
|
33
|
+
"lint-staged": {
|
|
34
|
+
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
|
|
35
|
+
"pnpm lint"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@biomejs/biome": "2.4.4",
|
|
40
|
+
"@tailwindcss/vite": "^4.1.13",
|
|
41
|
+
"@types/node": "^25.3.0",
|
|
42
|
+
"lint-staged": "~16.2.7",
|
|
43
|
+
"shiki": "^3.22.0",
|
|
44
|
+
"shiki-magic-move": "^1.2.1",
|
|
45
|
+
"simple-git-hooks": "^2.13.1",
|
|
46
|
+
"solid-bootstrap": "^1.0.21",
|
|
47
|
+
"solid-devtools": "^0.34.3",
|
|
48
|
+
"solid-js": "^1.9.11",
|
|
49
|
+
"tailwindcss": "^4.1.13",
|
|
50
|
+
"typescript": "~5.9.3",
|
|
51
|
+
"vite": "^7.3.1",
|
|
52
|
+
"vite-plugin-dts": "^4.5.4",
|
|
53
|
+
"vite-plugin-solid": "^2.11.8"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"dev": "vite --config vite.doc.config.ts",
|
|
57
|
+
"build": "tsc && vite build",
|
|
58
|
+
"build:doc": "tsc && vite build --config vite.doc.config.ts",
|
|
59
|
+
"preview": "vite preview",
|
|
60
|
+
"lint": "biome check --fix"
|
|
61
|
+
}
|
|
62
|
+
}
|