nuxt-ignis 0.5.0-rc.2 → 0.5.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.
Files changed (195) hide show
  1. package/.data/content/contents.sqlite +0 -0
  2. package/.nuxt/components.d.ts +402 -208
  3. package/.nuxt/content/components.ts +201 -104
  4. package/.nuxt/dev/index.mjs +1041 -712
  5. package/.nuxt/dev/index.mjs.map +1 -1
  6. package/.nuxt/dist/server/client.manifest.mjs +1 -18
  7. package/.nuxt/dist/server/client.precomputed.mjs +1 -0
  8. package/.nuxt/eslint-typegen.d.ts +56 -2
  9. package/.nuxt/eslint.config.d.mts +2 -2
  10. package/.nuxt/eslint.config.mjs +10 -10
  11. package/.nuxt/imports.d.ts +63 -59
  12. package/.nuxt/manifest/latest.json +1 -1
  13. package/.nuxt/manifest/meta/dev.json +1 -1
  14. package/.nuxt/mdc-highlighter.mjs +4 -0
  15. package/.nuxt/mdc-image-component.mjs +1 -1
  16. package/.nuxt/module/nuxt-robots.d.ts +12 -12
  17. package/.nuxt/module/nuxt-seo-utils.d.ts +10 -10
  18. package/.nuxt/module/nuxt-site-config.d.ts +8 -8
  19. package/.nuxt/module/nuxt-sitemap.d.ts +17 -17
  20. package/.nuxt/nitro.json +4 -4
  21. package/.nuxt/nuxt.d.ts +12 -11
  22. package/.nuxt/nuxt.json +2 -2
  23. package/.nuxt/nuxt.node.d.ts +13 -10
  24. package/.nuxt/tsconfig.app.json +191 -191
  25. package/.nuxt/tsconfig.json +194 -194
  26. package/.nuxt/tsconfig.node.json +105 -105
  27. package/.nuxt/tsconfig.server.json +128 -128
  28. package/.nuxt/tsconfig.shared.json +55 -55
  29. package/.nuxt/types/build.d.ts +2 -1
  30. package/.nuxt/types/components.d.ts +402 -208
  31. package/.nuxt/types/i18n-plugin.d.ts +2 -2
  32. package/.nuxt/types/imports.d.ts +348 -342
  33. package/.nuxt/types/modules.d.ts +16 -16
  34. package/.nuxt/types/nitro-imports.d.ts +68 -68
  35. package/.nuxt/types/nitro-nuxt.d.ts +1 -0
  36. package/.nuxt/types/nitro-routes.d.ts +20 -20
  37. package/.nuxt/types/plugins.d.ts +37 -37
  38. package/.nuxt/types/ui.d.ts +3 -3
  39. package/.nuxt/ui/drawer.ts +23 -0
  40. package/.nuxt/ui/progress.ts +3 -3
  41. package/.nuxt/ui-image-component.ts +1 -1
  42. package/.output/nitro.json +3 -3
  43. package/.output/public/_nuxt/1vOq3xiE.js +1 -0
  44. package/.output/public/_nuxt/22rhGZdI.js +1 -0
  45. package/.output/public/_nuxt/9eIdSibD.js +1 -0
  46. package/.output/public/_nuxt/BBmTy930.js +35 -0
  47. package/.output/public/_nuxt/BKe83Cjx.js +1 -0
  48. package/.output/public/_nuxt/Bc5GLloR.js +1 -0
  49. package/.output/public/_nuxt/BdG3SY-u.js +1 -0
  50. package/.output/public/_nuxt/BeyOQpYA.js +1 -0
  51. package/.output/public/_nuxt/BqcXd3MY.js +94 -0
  52. package/.output/public/_nuxt/Bz55A4y1.js +1 -0
  53. package/.output/public/_nuxt/C2ybsIQ4.js +1 -0
  54. package/.output/public/_nuxt/C4U5VOMJ.js +1 -0
  55. package/.output/public/_nuxt/CAJsyjAK.js +1 -0
  56. package/.output/public/_nuxt/CD9aBAuy.js +1 -0
  57. package/.output/public/_nuxt/CHOS7x_d.js +1 -0
  58. package/.output/public/_nuxt/CXhUbdF6.js +1 -0
  59. package/.output/public/_nuxt/CZWScI5k.js +1 -0
  60. package/.output/public/_nuxt/DHd34syF.js +1 -0
  61. package/.output/public/_nuxt/DMbgtwAJ.js +1 -0
  62. package/.output/public/_nuxt/DR8jhnFO.js +1 -0
  63. package/.output/public/_nuxt/DTT0LBLY.js +1 -0
  64. package/.output/public/_nuxt/{aetvq4w9.js → DWV_uL6G.js} +9 -12
  65. package/.output/public/_nuxt/DdpTKqR-.js +1 -0
  66. package/.output/public/_nuxt/Df_NcBcC.js +1 -0
  67. package/.output/public/_nuxt/DhqOMFXQ.js +1 -0
  68. package/.output/public/_nuxt/Dnp9eFDR.js +1 -0
  69. package/.output/public/_nuxt/DnqMs_6O.js +1 -0
  70. package/.output/public/_nuxt/Dq7g_IfY.js +1 -0
  71. package/.output/public/_nuxt/DsAJWnuW.js +1 -0
  72. package/.output/public/_nuxt/DvVg7vM_.js +1 -0
  73. package/.output/public/_nuxt/DwKqLVGx.js +1 -0
  74. package/.output/public/_nuxt/DxzqnQKF.js +1 -0
  75. package/.output/public/_nuxt/Y0f1tU-r.js +1 -0
  76. package/.output/public/_nuxt/atySmcu6.js +1 -0
  77. package/.output/public/_nuxt/builds/latest.json +1 -1
  78. package/.output/public/_nuxt/builds/meta/7bab2b8f-93ee-4f44-a604-8cd2b41eac60.json +1 -0
  79. package/.output/public/_nuxt/entry.CtpkPzPO.css +1 -0
  80. package/.output/public/_nuxt/error-404.DzDu4Ean.css +1 -0
  81. package/.output/public/_nuxt/error-500.BdNqqJx7.css +1 -0
  82. package/.output/public/_nuxt/q3i45eMH.js +1 -0
  83. package/.output/public/_nuxt/vueform.CkWb7x1C.css +1 -0
  84. package/.output/server/chunks/_/error-500.mjs +1 -1
  85. package/.output/server/chunks/_/error-500.mjs.map +1 -1
  86. package/.output/server/chunks/_/nitro.mjs +468 -543
  87. package/.output/server/chunks/_/nitro.mjs.map +1 -1
  88. package/.output/server/chunks/build/client.precomputed.mjs +4 -0
  89. package/.output/server/chunks/build/client.precomputed.mjs.map +1 -0
  90. package/.output/server/chunks/routes/renderer.mjs +10 -33
  91. package/.output/server/chunks/routes/renderer.mjs.map +1 -1
  92. package/.output/server/index.mjs.map +1 -1
  93. package/.output/server/node_modules/@babel/parser/lib/index.js +212 -145
  94. package/.output/server/node_modules/@babel/parser/package.json +3 -3
  95. package/.output/server/node_modules/@poppinss/utils/package.json +1 -1
  96. package/.output/server/node_modules/@shikijs/core/package.json +2 -2
  97. package/.output/server/node_modules/@shikijs/engine-javascript/package.json +2 -2
  98. package/.output/server/node_modules/@shikijs/engine-oniguruma/package.json +2 -2
  99. package/.output/server/node_modules/@shikijs/langs/dist/javascript.mjs +1 -1
  100. package/.output/server/node_modules/@shikijs/langs/dist/typescript.mjs +1 -1
  101. package/.output/server/node_modules/@shikijs/langs/package.json +11 -3
  102. package/.output/server/node_modules/@shikijs/themes/package.json +3 -3
  103. package/.output/server/node_modules/@shikijs/transformers/package.json +3 -3
  104. package/.output/server/node_modules/@shikijs/types/package.json +1 -1
  105. package/.output/server/node_modules/detect-libc/lib/detect-libc.js +59 -13
  106. package/.output/server/node_modules/detect-libc/lib/elf.js +39 -0
  107. package/.output/server/node_modules/detect-libc/lib/filesystem.js +18 -8
  108. package/.output/server/node_modules/detect-libc/package.json +5 -2
  109. package/.output/server/node_modules/devalue/package.json +1 -1
  110. package/.output/server/node_modules/devalue/src/parse.js +7 -1
  111. package/.output/server/node_modules/devalue/src/uneval.js +9 -8
  112. package/.output/server/node_modules/fast-xml-parser/package.json +1 -1
  113. package/.output/server/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +297 -287
  114. package/.output/server/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +3 -2
  115. package/.output/server/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +4 -4
  116. package/.output/server/node_modules/image-meta/dist/index.mjs +85 -4
  117. package/.output/server/node_modules/image-meta/package.json +12 -12
  118. package/.output/server/node_modules/is-arrayish/package.json +1 -1
  119. package/.output/server/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +2 -2
  120. package/.output/server/node_modules/node-fetch-native/dist/node.mjs +10 -10
  121. package/.output/server/node_modules/node-fetch-native/package.json +13 -13
  122. package/.output/server/node_modules/node-mock-http/dist/index.mjs +1 -1
  123. package/.output/server/node_modules/node-mock-http/package.json +6 -6
  124. package/.output/server/node_modules/oauth4webapi/build/index.js +10 -8
  125. package/.output/server/node_modules/oauth4webapi/package.json +12 -12
  126. package/.output/server/node_modules/openid-client/build/index.js +1 -1
  127. package/.output/server/node_modules/openid-client/package.json +7 -7
  128. package/.output/server/node_modules/secure-json-parse/index.js +35 -0
  129. package/.output/server/node_modules/secure-json-parse/package.json +2 -3
  130. package/.output/server/node_modules/semver/classes/semver.js +19 -5
  131. package/.output/server/node_modules/semver/internal/identifiers.js +4 -0
  132. package/.output/server/node_modules/semver/package.json +3 -3
  133. package/.output/server/node_modules/shiki/package.json +9 -9
  134. package/.output/server/node_modules/simple-swizzle/package.json +1 -1
  135. package/.output/server/node_modules/unhead/dist/parser.mjs +508 -0
  136. package/.output/server/node_modules/unhead/dist/server.mjs +6 -513
  137. package/.output/server/node_modules/unhead/package.json +5 -1
  138. package/.output/server/node_modules/unist-util-is/lib/index.js +10 -5
  139. package/.output/server/node_modules/unist-util-is/package.json +12 -9
  140. package/.output/server/node_modules/unist-util-visit-parents/lib/index.js +8 -7
  141. package/.output/server/node_modules/unist-util-visit-parents/package.json +18 -13
  142. package/.output/server/node_modules/yaml/dist/stringify/stringifyString.js +1 -1
  143. package/.output/server/node_modules/yaml/package.json +2 -1
  144. package/.output/server/package.json +27 -27
  145. package/bin/cli.js +23 -16
  146. package/bin/set-app-vue.js +3 -1
  147. package/bin/set-css.js +3 -1
  148. package/bin/set-eslint.js +3 -1
  149. package/bin/setup.js +10 -7
  150. package/nuxt.config.ts +13 -1
  151. package/package.json +15 -12
  152. package/test/versions.test.ts +65 -0
  153. package/vitest.config.ts +5 -5
  154. package/.nuxt/dist/server/client.manifest.json +0 -18
  155. package/.output/public/_nuxt/1soVlS0z.js +0 -1
  156. package/.output/public/_nuxt/B7rsWaa2.js +0 -1
  157. package/.output/public/_nuxt/BFreiu22.js +0 -1
  158. package/.output/public/_nuxt/BLcTglbc.js +0 -1
  159. package/.output/public/_nuxt/Bhd4_yFT.js +0 -1
  160. package/.output/public/_nuxt/Bhpb4lc3.js +0 -1
  161. package/.output/public/_nuxt/Bi2eMDmd.js +0 -1
  162. package/.output/public/_nuxt/Bm30MqE0.js +0 -1
  163. package/.output/public/_nuxt/BqsN2CZp.js +0 -1
  164. package/.output/public/_nuxt/Bs3IGOdt.js +0 -1
  165. package/.output/public/_nuxt/ByaiRTkI.js +0 -1
  166. package/.output/public/_nuxt/C9ePPGPX.js +0 -94
  167. package/.output/public/_nuxt/CA578xwz.js +0 -1
  168. package/.output/public/_nuxt/CDttUXKg.js +0 -1
  169. package/.output/public/_nuxt/CQozUI2A.js +0 -1
  170. package/.output/public/_nuxt/CSN71QT8.js +0 -1
  171. package/.output/public/_nuxt/CqCaqSd2.js +0 -1
  172. package/.output/public/_nuxt/D8v-efI7.js +0 -1
  173. package/.output/public/_nuxt/DBJqMhGy.js +0 -35
  174. package/.output/public/_nuxt/DR4hWRk7.js +0 -1
  175. package/.output/public/_nuxt/DRroQ-Xq.js +0 -1
  176. package/.output/public/_nuxt/DStnBfJS.js +0 -1
  177. package/.output/public/_nuxt/DXTYyv-V.js +0 -1
  178. package/.output/public/_nuxt/DeS1g0YT.js +0 -1
  179. package/.output/public/_nuxt/Deb6R53f.js +0 -1
  180. package/.output/public/_nuxt/DiDHllLr.js +0 -1
  181. package/.output/public/_nuxt/DvwlldUy.js +0 -1
  182. package/.output/public/_nuxt/DyCICqRh.js +0 -1
  183. package/.output/public/_nuxt/DzT4wm3Y.js +0 -1
  184. package/.output/public/_nuxt/E8nje24C.js +0 -1
  185. package/.output/public/_nuxt/RbPLLy5S.js +0 -1
  186. package/.output/public/_nuxt/builds/meta/cbc9377a-971e-4db1-b4b1-01807b82ee58.json +0 -1
  187. package/.output/public/_nuxt/entry.whtwWr_z.css +0 -1
  188. package/.output/public/_nuxt/error-404.Cq535Uij.css +0 -1
  189. package/.output/public/_nuxt/error-500.BHm_N15n.css +0 -1
  190. package/.output/public/_nuxt/jpnxxCHq.js +0 -1
  191. package/.output/public/_nuxt/sHsV3x2B.js +0 -1
  192. package/.output/public/_nuxt/sQEqbbg2.js +0 -1
  193. package/.output/public/_nuxt/vueform.ChEauysg.css +0 -1
  194. package/.output/server/chunks/build/client.manifest.mjs +0 -511
  195. package/.output/server/chunks/build/client.manifest.mjs.map +0 -1
@@ -1,358 +1,368 @@
1
1
  import {isName} from '../util.js';
2
2
 
3
- //TODO: handle comments
4
- export default function readDocType(xmlData, i){
3
+ export default class DocTypeReader{
4
+ constructor(processEntities){
5
+ this.suppressValidationErr = !processEntities;
6
+ }
5
7
 
6
- const entities = {};
7
- if( xmlData[i + 3] === 'O' &&
8
- xmlData[i + 4] === 'C' &&
9
- xmlData[i + 5] === 'T' &&
10
- xmlData[i + 6] === 'Y' &&
11
- xmlData[i + 7] === 'P' &&
12
- xmlData[i + 8] === 'E')
13
- {
14
- i = i+9;
15
- let angleBracketsCount = 1;
16
- let hasBody = false, comment = false;
17
- let exp = "";
18
- for(;i<xmlData.length;i++){
19
- if (xmlData[i] === '<' && !comment) { //Determine the tag type
20
- if( hasBody && hasSeq(xmlData, "!ENTITY",i)){
21
- i += 7;
22
- let entityName, val;
23
- [entityName, val,i] = readEntityExp(xmlData,i+1);
24
- if(val.indexOf("&") === -1) //Parameter entities are not supported
25
- entities[ entityName ] = {
26
- regx : RegExp( `&${entityName};`,"g"),
27
- val: val
28
- };
29
- }
30
- else if( hasBody && hasSeq(xmlData, "!ELEMENT",i)) {
31
- i += 8;//Not supported
32
- const {index} = readElementExp(xmlData,i+1);
33
- i = index;
34
- }else if( hasBody && hasSeq(xmlData, "!ATTLIST",i)){
35
- i += 8;//Not supported
36
- // const {index} = readAttlistExp(xmlData,i+1);
37
- // i = index;
38
- }else if( hasBody && hasSeq(xmlData, "!NOTATION",i)) {
39
- i += 9;//Not supported
40
- const {index} = readNotationExp(xmlData,i+1);
41
- i = index;
42
- }else if( hasSeq(xmlData, "!--",i) ) comment = true;
43
- else throw new Error(`Invalid DOCTYPE`);
44
-
45
- angleBracketsCount++;
46
- exp = "";
47
- } else if (xmlData[i] === '>') { //Read tag content
48
- if(comment){
49
- if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){
50
- comment = false;
8
+ readDocType(xmlData, i){
9
+
10
+ const entities = {};
11
+ if( xmlData[i + 3] === 'O' &&
12
+ xmlData[i + 4] === 'C' &&
13
+ xmlData[i + 5] === 'T' &&
14
+ xmlData[i + 6] === 'Y' &&
15
+ xmlData[i + 7] === 'P' &&
16
+ xmlData[i + 8] === 'E')
17
+ {
18
+ i = i+9;
19
+ let angleBracketsCount = 1;
20
+ let hasBody = false, comment = false;
21
+ let exp = "";
22
+ for(;i<xmlData.length;i++){
23
+ if (xmlData[i] === '<' && !comment) { //Determine the tag type
24
+ if( hasBody && hasSeq(xmlData, "!ENTITY",i)){
25
+ i += 7;
26
+ let entityName, val;
27
+ [entityName, val,i] = this.readEntityExp(xmlData,i+1,this.suppressValidationErr);
28
+ if(val.indexOf("&") === -1) //Parameter entities are not supported
29
+ entities[ entityName ] = {
30
+ regx : RegExp( `&${entityName};`,"g"),
31
+ val: val
32
+ };
33
+ }
34
+ else if( hasBody && hasSeq(xmlData, "!ELEMENT",i)) {
35
+ i += 8;//Not supported
36
+ const {index} = this.readElementExp(xmlData,i+1);
37
+ i = index;
38
+ }else if( hasBody && hasSeq(xmlData, "!ATTLIST",i)){
39
+ i += 8;//Not supported
40
+ // const {index} = this.readAttlistExp(xmlData,i+1);
41
+ // i = index;
42
+ }else if( hasBody && hasSeq(xmlData, "!NOTATION",i)) {
43
+ i += 9;//Not supported
44
+ const {index} = this.readNotationExp(xmlData,i+1,this.suppressValidationErr);
45
+ i = index;
46
+ }else if( hasSeq(xmlData, "!--",i) ) comment = true;
47
+ else throw new Error(`Invalid DOCTYPE`);
48
+
49
+ angleBracketsCount++;
50
+ exp = "";
51
+ } else if (xmlData[i] === '>') { //Read tag content
52
+ if(comment){
53
+ if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){
54
+ comment = false;
55
+ angleBracketsCount--;
56
+ }
57
+ }else{
51
58
  angleBracketsCount--;
52
59
  }
60
+ if (angleBracketsCount === 0) {
61
+ break;
62
+ }
63
+ }else if( xmlData[i] === '['){
64
+ hasBody = true;
53
65
  }else{
54
- angleBracketsCount--;
55
- }
56
- if (angleBracketsCount === 0) {
57
- break;
66
+ exp += xmlData[i];
58
67
  }
59
- }else if( xmlData[i] === '['){
60
- hasBody = true;
61
- }else{
62
- exp += xmlData[i];
63
68
  }
69
+ if(angleBracketsCount !== 0){
70
+ throw new Error(`Unclosed DOCTYPE`);
71
+ }
72
+ }else{
73
+ throw new Error(`Invalid Tag instead of DOCTYPE`);
64
74
  }
65
- if(angleBracketsCount !== 0){
66
- throw new Error(`Unclosed DOCTYPE`);
67
- }
68
- }else{
69
- throw new Error(`Invalid Tag instead of DOCTYPE`);
75
+ return {entities, i};
70
76
  }
71
- return {entities, i};
72
- }
77
+ readEntityExp(xmlData, i) {
78
+ //External entities are not supported
79
+ // <!ENTITY ext SYSTEM "http://normal-website.com" >
73
80
 
74
- const skipWhitespace = (data, index) => {
75
- while (index < data.length && /\s/.test(data[index])) {
76
- index++;
77
- }
78
- return index;
79
- };
80
-
81
- function readEntityExp(xmlData, i) {
82
- //External entities are not supported
83
- // <!ENTITY ext SYSTEM "http://normal-website.com" >
81
+ //Parameter entities are not supported
82
+ // <!ENTITY entityname "&anotherElement;">
84
83
 
85
- //Parameter entities are not supported
86
- // <!ENTITY entityname "&anotherElement;">
84
+ //Internal entities are supported
85
+ // <!ENTITY entityname "replacement text">
87
86
 
88
- //Internal entities are supported
89
- // <!ENTITY entityname "replacement text">
87
+ // Skip leading whitespace after <!ENTITY
88
+ i = skipWhitespace(xmlData, i);
90
89
 
91
- // Skip leading whitespace after <!ENTITY
92
- i = skipWhitespace(xmlData, i);
90
+ // Read entity name
91
+ let entityName = "";
92
+ while (i < xmlData.length && !/\s/.test(xmlData[i]) && xmlData[i] !== '"' && xmlData[i] !== "'") {
93
+ entityName += xmlData[i];
94
+ i++;
95
+ }
96
+ validateEntityName(entityName);
93
97
 
94
- // Read entity name
95
- let entityName = "";
96
- while (i < xmlData.length && !/\s/.test(xmlData[i]) && xmlData[i] !== '"' && xmlData[i] !== "'") {
97
- entityName += xmlData[i];
98
- i++;
99
- }
100
- validateEntityName(entityName);
98
+ // Skip whitespace after entity name
99
+ i = skipWhitespace(xmlData, i);
101
100
 
102
- // Skip whitespace after entity name
103
- i = skipWhitespace(xmlData, i);
101
+ // Check for unsupported constructs (external entities or parameter entities)
102
+ if(!this.suppressValidationErr){
103
+ if (xmlData.substring(i, i + 6).toUpperCase() === "SYSTEM") {
104
+ throw new Error("External entities are not supported");
105
+ }else if (xmlData[i] === "%") {
106
+ throw new Error("Parameter entities are not supported");
107
+ }
108
+ }
104
109
 
105
- // Check for unsupported constructs (external entities or parameter entities)
106
- if (xmlData.substring(i, i + 6).toUpperCase() === "SYSTEM") {
107
- throw new Error("External entities are not supported");
108
- }else if (xmlData[i] === "%") {
109
- throw new Error("Parameter entities are not supported");
110
+ // Read entity value (internal entity)
111
+ let entityValue = "";
112
+ [i, entityValue] = this.readIdentifierVal(xmlData, i, "entity");
113
+ i--;
114
+ return [entityName, entityValue, i ];
110
115
  }
111
116
 
112
- // Read entity value (internal entity)
113
- let entityValue = "";
114
- [i, entityValue] = readIdentifierVal(xmlData, i, "entity");
115
- i--;
116
- return [entityName, entityValue, i ];
117
- }
118
-
119
- function readNotationExp(xmlData, i) {
120
- // Skip leading whitespace after <!NOTATION
121
- i = skipWhitespace(xmlData, i);
117
+ readNotationExp(xmlData, i) {
118
+ // Skip leading whitespace after <!NOTATION
119
+ i = skipWhitespace(xmlData, i);
122
120
 
123
- // Read notation name
124
- let notationName = "";
125
- while (i < xmlData.length && !/\s/.test(xmlData[i])) {
126
- notationName += xmlData[i];
127
- i++;
128
- }
129
- validateEntityName(notationName);
121
+ // Read notation name
122
+ let notationName = "";
123
+ while (i < xmlData.length && !/\s/.test(xmlData[i])) {
124
+ notationName += xmlData[i];
125
+ i++;
126
+ }
127
+ !this.suppressValidationErr && validateEntityName(notationName);
130
128
 
131
- // Skip whitespace after notation name
132
- i = skipWhitespace(xmlData, i);
129
+ // Skip whitespace after notation name
130
+ i = skipWhitespace(xmlData, i);
133
131
 
134
- // Check identifier type (SYSTEM or PUBLIC)
135
- const identifierType = xmlData.substring(i, i + 6).toUpperCase();
136
- if (identifierType !== "SYSTEM" && identifierType !== "PUBLIC") {
137
- throw new Error(`Expected SYSTEM or PUBLIC, found "${identifierType}"`);
138
- }
139
- i += identifierType.length;
132
+ // Check identifier type (SYSTEM or PUBLIC)
133
+ const identifierType = xmlData.substring(i, i + 6).toUpperCase();
134
+ if (!this.suppressValidationErr && identifierType !== "SYSTEM" && identifierType !== "PUBLIC") {
135
+ throw new Error(`Expected SYSTEM or PUBLIC, found "${identifierType}"`);
136
+ }
137
+ i += identifierType.length;
140
138
 
141
- // Skip whitespace after identifier type
142
- i = skipWhitespace(xmlData, i);
139
+ // Skip whitespace after identifier type
140
+ i = skipWhitespace(xmlData, i);
143
141
 
144
- // Read public identifier (if PUBLIC)
145
- let publicIdentifier = null;
146
- let systemIdentifier = null;
142
+ // Read public identifier (if PUBLIC)
143
+ let publicIdentifier = null;
144
+ let systemIdentifier = null;
147
145
 
148
- if (identifierType === "PUBLIC") {
149
- [i, publicIdentifier ] = readIdentifierVal(xmlData, i, "publicIdentifier");
146
+ if (identifierType === "PUBLIC") {
147
+ [i, publicIdentifier ] = this.readIdentifierVal(xmlData, i, "publicIdentifier");
150
148
 
151
- // Skip whitespace after public identifier
152
- i = skipWhitespace(xmlData, i);
149
+ // Skip whitespace after public identifier
150
+ i = skipWhitespace(xmlData, i);
153
151
 
154
- // Optionally read system identifier
155
- if (xmlData[i] === '"' || xmlData[i] === "'") {
156
- [i, systemIdentifier ] = readIdentifierVal(xmlData, i,"systemIdentifier");
157
- }
158
- } else if (identifierType === "SYSTEM") {
159
- // Read system identifier (mandatory for SYSTEM)
160
- [i, systemIdentifier ] = readIdentifierVal(xmlData, i, "systemIdentifier");
152
+ // Optionally read system identifier
153
+ if (xmlData[i] === '"' || xmlData[i] === "'") {
154
+ [i, systemIdentifier ] = this.readIdentifierVal(xmlData, i,"systemIdentifier");
155
+ }
156
+ } else if (identifierType === "SYSTEM") {
157
+ // Read system identifier (mandatory for SYSTEM)
158
+ [i, systemIdentifier ] = this.readIdentifierVal(xmlData, i, "systemIdentifier");
161
159
 
162
- if (!systemIdentifier) {
163
- throw new Error("Missing mandatory system identifier for SYSTEM notation");
160
+ if (!this.suppressValidationErr && !systemIdentifier) {
161
+ throw new Error("Missing mandatory system identifier for SYSTEM notation");
162
+ }
164
163
  }
164
+
165
+ return {notationName, publicIdentifier, systemIdentifier, index: --i};
165
166
  }
166
-
167
- return {notationName, publicIdentifier, systemIdentifier, index: --i};
168
- }
169
-
170
- function readIdentifierVal(xmlData, i, type) {
171
- let identifierVal = "";
172
- const startChar = xmlData[i];
173
- if (startChar !== '"' && startChar !== "'") {
174
- throw new Error(`Expected quoted string, found "${startChar}"`);
175
- }
176
- i++;
177
167
 
178
- while (i < xmlData.length && xmlData[i] !== startChar) {
179
- identifierVal += xmlData[i];
168
+ readIdentifierVal(xmlData, i, type) {
169
+ let identifierVal = "";
170
+ const startChar = xmlData[i];
171
+ if (startChar !== '"' && startChar !== "'") {
172
+ throw new Error(`Expected quoted string, found "${startChar}"`);
173
+ }
180
174
  i++;
181
- }
182
175
 
183
- if (xmlData[i] !== startChar) {
184
- throw new Error(`Unterminated ${type} value`);
185
- }
186
- i++;
187
- return [i, identifierVal];
188
- }
189
-
190
- function readElementExp(xmlData, i) {
191
- // <!ELEMENT br EMPTY>
192
- // <!ELEMENT div ANY>
193
- // <!ELEMENT title (#PCDATA)>
194
- // <!ELEMENT book (title, author+)>
195
- // <!ELEMENT name (content-model)>
196
-
197
- // Skip leading whitespace after <!ELEMENT
198
- i = skipWhitespace(xmlData, i);
176
+ while (i < xmlData.length && xmlData[i] !== startChar) {
177
+ identifierVal += xmlData[i];
178
+ i++;
179
+ }
199
180
 
200
- // Read element name
201
- let elementName = "";
202
- while (i < xmlData.length && !/\s/.test(xmlData[i])) {
203
- elementName += xmlData[i];
181
+ if (xmlData[i] !== startChar) {
182
+ throw new Error(`Unterminated ${type} value`);
183
+ }
204
184
  i++;
185
+ return [i, identifierVal];
205
186
  }
206
187
 
207
- // Validate element name
208
- if (!validateEntityName(elementName)) {
209
- throw new Error(`Invalid element name: "${elementName}"`);
210
- }
188
+ readElementExp(xmlData, i) {
189
+ // <!ELEMENT br EMPTY>
190
+ // <!ELEMENT div ANY>
191
+ // <!ELEMENT title (#PCDATA)>
192
+ // <!ELEMENT book (title, author+)>
193
+ // <!ELEMENT name (content-model)>
194
+
195
+ // Skip leading whitespace after <!ELEMENT
196
+ i = skipWhitespace(xmlData, i);
211
197
 
212
- // Skip whitespace after element name
213
- i = skipWhitespace(xmlData, i);
214
- let contentModel = "";
215
- // Expect '(' to start content model
216
- if(xmlData[i] === "E" && hasSeq(xmlData, "MPTY",i)) i+=4;
217
- else if(xmlData[i] === "A" && hasSeq(xmlData, "NY",i)) i+=2;
218
- else if (xmlData[i] === "(") {
219
- i++; // Move past '('
220
-
221
- // Read content model
222
- while (i < xmlData.length && xmlData[i] !== ")") {
223
- contentModel += xmlData[i];
198
+ // Read element name
199
+ let elementName = "";
200
+ while (i < xmlData.length && !/\s/.test(xmlData[i])) {
201
+ elementName += xmlData[i];
224
202
  i++;
225
203
  }
226
- if (xmlData[i] !== ")") {
227
- throw new Error("Unterminated content model");
228
- }
229
204
 
230
- }else{
231
- throw new Error(`Invalid Element Expression, found "${xmlData[i]}"`);
232
- }
233
-
234
- return {
235
- elementName,
236
- contentModel: contentModel.trim(),
237
- index: i
238
- };
239
- }
205
+ // Validate element name
206
+ if (!this.suppressValidationErr && !isName(elementName)) {
207
+ throw new Error(`Invalid element name: "${elementName}"`);
208
+ }
240
209
 
241
- function readAttlistExp(xmlData, i) {
242
- // Skip leading whitespace after <!ATTLIST
243
- i = skipWhitespace(xmlData, i);
210
+ // Skip whitespace after element name
211
+ i = skipWhitespace(xmlData, i);
212
+ let contentModel = "";
213
+ // Expect '(' to start content model
214
+ if(xmlData[i] === "E" && hasSeq(xmlData, "MPTY",i)) i+=4;
215
+ else if(xmlData[i] === "A" && hasSeq(xmlData, "NY",i)) i+=2;
216
+ else if (xmlData[i] === "(") {
217
+ i++; // Move past '('
218
+
219
+ // Read content model
220
+ while (i < xmlData.length && xmlData[i] !== ")") {
221
+ contentModel += xmlData[i];
222
+ i++;
223
+ }
224
+ if (xmlData[i] !== ")") {
225
+ throw new Error("Unterminated content model");
226
+ }
244
227
 
245
- // Read element name
246
- let elementName = "";
247
- while (i < xmlData.length && !/\s/.test(xmlData[i])) {
248
- elementName += xmlData[i];
249
- i++;
228
+ }else if(!this.suppressValidationErr){
229
+ throw new Error(`Invalid Element Expression, found "${xmlData[i]}"`);
230
+ }
231
+
232
+ return {
233
+ elementName,
234
+ contentModel: contentModel.trim(),
235
+ index: i
236
+ };
250
237
  }
251
238
 
252
- // Validate element name
253
- validateEntityName(elementName)
239
+ readAttlistExp(xmlData, i) {
240
+ // Skip leading whitespace after <!ATTLIST
241
+ i = skipWhitespace(xmlData, i);
254
242
 
255
- // Skip whitespace after element name
256
- i = skipWhitespace(xmlData, i);
243
+ // Read element name
244
+ let elementName = "";
245
+ while (i < xmlData.length && !/\s/.test(xmlData[i])) {
246
+ elementName += xmlData[i];
247
+ i++;
248
+ }
257
249
 
258
- // Read attribute name
259
- let attributeName = "";
260
- while (i < xmlData.length && !/\s/.test(xmlData[i])) {
261
- attributeName += xmlData[i];
262
- i++;
263
- }
250
+ // Validate element name
251
+ validateEntityName(elementName)
264
252
 
265
- // Validate attribute name
266
- if (!validateEntityName(attributeName)) {
267
- throw new Error(`Invalid attribute name: "${attributeName}"`);
268
- }
253
+ // Skip whitespace after element name
254
+ i = skipWhitespace(xmlData, i);
269
255
 
270
- // Skip whitespace after attribute name
271
- i = skipWhitespace(xmlData, i);
256
+ // Read attribute name
257
+ let attributeName = "";
258
+ while (i < xmlData.length && !/\s/.test(xmlData[i])) {
259
+ attributeName += xmlData[i];
260
+ i++;
261
+ }
272
262
 
273
- // Read attribute type
274
- let attributeType = "";
275
- if (xmlData.substring(i, i + 8).toUpperCase() === "NOTATION") {
276
- attributeType = "NOTATION";
277
- i += 8; // Move past "NOTATION"
263
+ // Validate attribute name
264
+ if (!validateEntityName(attributeName)) {
265
+ throw new Error(`Invalid attribute name: "${attributeName}"`);
266
+ }
278
267
 
279
- // Skip whitespace after "NOTATION"
268
+ // Skip whitespace after attribute name
280
269
  i = skipWhitespace(xmlData, i);
281
270
 
282
- // Expect '(' to start the list of notations
283
- if (xmlData[i] !== "(") {
284
- throw new Error(`Expected '(', found "${xmlData[i]}"`);
285
- }
286
- i++; // Move past '('
287
-
288
- // Read the list of allowed notations
289
- let allowedNotations = [];
290
- while (i < xmlData.length && xmlData[i] !== ")") {
291
- let notation = "";
292
- while (i < xmlData.length && xmlData[i] !== "|" && xmlData[i] !== ")") {
293
- notation += xmlData[i];
294
- i++;
271
+ // Read attribute type
272
+ let attributeType = "";
273
+ if (xmlData.substring(i, i + 8).toUpperCase() === "NOTATION") {
274
+ attributeType = "NOTATION";
275
+ i += 8; // Move past "NOTATION"
276
+
277
+ // Skip whitespace after "NOTATION"
278
+ i = skipWhitespace(xmlData, i);
279
+
280
+ // Expect '(' to start the list of notations
281
+ if (xmlData[i] !== "(") {
282
+ throw new Error(`Expected '(', found "${xmlData[i]}"`);
295
283
  }
284
+ i++; // Move past '('
285
+
286
+ // Read the list of allowed notations
287
+ let allowedNotations = [];
288
+ while (i < xmlData.length && xmlData[i] !== ")") {
289
+ let notation = "";
290
+ while (i < xmlData.length && xmlData[i] !== "|" && xmlData[i] !== ")") {
291
+ notation += xmlData[i];
292
+ i++;
293
+ }
294
+
295
+ // Validate notation name
296
+ notation = notation.trim();
297
+ if (!validateEntityName(notation)) {
298
+ throw new Error(`Invalid notation name: "${notation}"`);
299
+ }
300
+
301
+ allowedNotations.push(notation);
296
302
 
297
- // Validate notation name
298
- notation = notation.trim();
299
- if (!validateEntityName(notation)) {
300
- throw new Error(`Invalid notation name: "${notation}"`);
303
+ // Skip '|' separator or exit loop
304
+ if (xmlData[i] === "|") {
305
+ i++; // Move past '|'
306
+ i = skipWhitespace(xmlData, i); // Skip optional whitespace after '|'
307
+ }
301
308
  }
302
309
 
303
- allowedNotations.push(notation);
310
+ if (xmlData[i] !== ")") {
311
+ throw new Error("Unterminated list of notations");
312
+ }
313
+ i++; // Move past ')'
314
+
315
+ // Store the allowed notations as part of the attribute type
316
+ attributeType += " (" + allowedNotations.join("|") + ")";
317
+ } else {
318
+ // Handle simple types (e.g., CDATA, ID, IDREF, etc.)
319
+ while (i < xmlData.length && !/\s/.test(xmlData[i])) {
320
+ attributeType += xmlData[i];
321
+ i++;
322
+ }
304
323
 
305
- // Skip '|' separator or exit loop
306
- if (xmlData[i] === "|") {
307
- i++; // Move past '|'
308
- i = skipWhitespace(xmlData, i); // Skip optional whitespace after '|'
324
+ // Validate simple attribute type
325
+ const validTypes = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
326
+ if (!this.suppressValidationErr && !validTypes.includes(attributeType.toUpperCase())) {
327
+ throw new Error(`Invalid attribute type: "${attributeType}"`);
309
328
  }
310
329
  }
311
330
 
312
- if (xmlData[i] !== ")") {
313
- throw new Error("Unterminated list of notations");
314
- }
315
- i++; // Move past ')'
331
+ // Skip whitespace after attribute type
332
+ i = skipWhitespace(xmlData, i);
316
333
 
317
- // Store the allowed notations as part of the attribute type
318
- attributeType += " (" + allowedNotations.join("|") + ")";
319
- } else {
320
- // Handle simple types (e.g., CDATA, ID, IDREF, etc.)
321
- while (i < xmlData.length && !/\s/.test(xmlData[i])) {
322
- attributeType += xmlData[i];
323
- i++;
334
+ // Read default value
335
+ let defaultValue = "";
336
+ if (xmlData.substring(i, i + 8).toUpperCase() === "#REQUIRED") {
337
+ defaultValue = "#REQUIRED";
338
+ i += 8;
339
+ } else if (xmlData.substring(i, i + 7).toUpperCase() === "#IMPLIED") {
340
+ defaultValue = "#IMPLIED";
341
+ i += 7;
342
+ } else {
343
+ [i, defaultValue] = this.readIdentifierVal(xmlData, i, "ATTLIST");
324
344
  }
325
345
 
326
- // Validate simple attribute type
327
- const validTypes = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
328
- if (!validTypes.includes(attributeType.toUpperCase())) {
329
- throw new Error(`Invalid attribute type: "${attributeType}"`);
346
+ return {
347
+ elementName,
348
+ attributeName,
349
+ attributeType,
350
+ defaultValue,
351
+ index: i
330
352
  }
331
353
  }
354
+ }
332
355
 
333
- // Skip whitespace after attribute type
334
- i = skipWhitespace(xmlData, i);
335
-
336
- // Read default value
337
- let defaultValue = "";
338
- if (xmlData.substring(i, i + 8).toUpperCase() === "#REQUIRED") {
339
- defaultValue = "#REQUIRED";
340
- i += 8;
341
- } else if (xmlData.substring(i, i + 7).toUpperCase() === "#IMPLIED") {
342
- defaultValue = "#IMPLIED";
343
- i += 7;
344
- } else {
345
- [i, defaultValue] = readIdentifierVal(xmlData, i, "ATTLIST");
346
- }
347
356
 
348
- return {
349
- elementName,
350
- attributeName,
351
- attributeType,
352
- defaultValue,
353
- index: i
357
+
358
+ const skipWhitespace = (data, index) => {
359
+ while (index < data.length && /\s/.test(data[index])) {
360
+ index++;
354
361
  }
355
- }
362
+ return index;
363
+ };
364
+
365
+
356
366
 
357
367
  function hasSeq(data, seq,i){
358
368
  for(let j=0;j<seq.length;j++){
@@ -363,7 +373,7 @@ function hasSeq(data, seq,i){
363
373
 
364
374
  function validateEntityName(name){
365
375
  if (isName(name))
366
- return name;
376
+ return name;
367
377
  else
368
378
  throw new Error(`Invalid entity name ${name}`);
369
379
  }