1 |
- {"version":3,"sources":["util.js"],"names":["Object","defineProperty","exports","value","rewireSpecs","rewireSource","seedTokens","seedSpec","seedBlock","splitLines","splitSpace","splitCR","hasCR","isSpace","source","test","matches","match","slice","length","split","block","assign","description","tags","problems","spec","tag","name","type","optional","tokens","start","delimiter","postDelimiter","postTag","postName","postType","end","lineEnd","reduce","acc","line","set","number","Map","map","get"],"mappings":"AAAA;;AACAA,MAAM,CAACC,cAAP,CAAsBC,OAAtB,EAA+B,YAA/B,EAA6C;AAAEC,EAAAA,KAAK,EAAE;AAAT,CAA7C;AACAD,OAAO,CAACE,WAAR,GAAsBF,OAAO,CAACG,YAAR,GAAuBH,OAAO,CAACI,UAAR,GAAqBJ,OAAO,CAACK,QAAR,GAAmBL,OAAO,CAACM,SAAR,GAAoBN,OAAO,CAACO,UAAR,GAAqBP,OAAO,CAACQ,UAAR,GAAqBR,OAAO,CAACS,OAAR,GAAkBT,OAAO,CAACU,KAAR,GAAgBV,OAAO,CAACW,OAAR,GAAkB,KAAK,CAA5M;;AACA,SAASA,OAAT,CAAiBC,MAAjB,EAAyB;AACrB,SAAO,QAAQC,IAAR,CAAaD,MAAb,CAAP;AACH;;AACDZ,OAAO,CAACW,OAAR,GAAkBA,OAAlB;;AACA,SAASD,KAAT,CAAeE,MAAf,EAAuB;AACnB,SAAO,MAAMC,IAAN,CAAWD,MAAX,CAAP;AACH;;AACDZ,OAAO,CAACU,KAAR,GAAgBA,KAAhB;;AACA,SAASD,OAAT,CAAiBG,MAAjB,EAAyB;AACrB,QAAME,OAAO,GAAGF,MAAM,CAACG,KAAP,CAAa,MAAb,CAAhB;AACA,SAAOD,OAAO,IAAI,IAAX,GACD,CAAC,EAAD,EAAKF,MAAL,CADC,GAED,CAACA,MAAM,CAACI,KAAP,CAAa,CAACF,OAAO,CAAC,CAAD,CAAP,CAAWG,MAAzB,CAAD,EAAmCL,MAAM,CAACI,KAAP,CAAa,CAAb,EAAgB,CAACF,OAAO,CAAC,CAAD,CAAP,CAA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;AACA;AACA;AACA;AACA;AACA;;AACA,SAASD,WAAT,CAAqBiB,KAArB,EAA4B;AACxB,QAAMP,MAAM,GAAGO,KAAK,CAACG,IAAN,CAAWgB,MAAX,CAAkB,CAACC,GAAD,EAAMf,IAAN,KAAeA,IAAI,CAACZ,MAAL,CAAY0B,MAAZ,CAAmB,CAACC,GAAD,EAAMC,IAAN,KAAeD,GAAG,CAACE,GAAJ,CAAQD,IAAI,CAACE,MAAb,EAAqBF,IAArB,CAAlC,EAA8DD,GAA9D,CAAjC,EAAqG,IAAII,GAAJ,EAArG,CAAf;AACAxB,EAAAA,KAAK,CAACP,MAAN,GAAeO,KAAK,CAACP,MAAN,CAAagC,GAAb,CAAkBJ,IAAD,IAAU5B,MAAM,CAACiC,GAAP,CAAWL,IAAI,CAACE,MAAhB,KAA2BF,IAAtD,CAAf;AACA,SAAOrB,KAAP;AACH;;AACDnB,OAAO,CAACE,WAAR,GAAsBA,WAAtB","sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.rewireSpecs = exports.rewireSource = exports.seedTokens = exports.seedSpec = exports.seedBlock = exports.splitLines = exports.splitSpace = exports.splitCR = exports.hasCR = exports.isSpace = void 0;\nfunction isSpace(source) {\n return /^\\s+$/.test(source);\n}\nexports.isSpace = isSpace;\nfunction hasCR(source) {\n return /\\r$/.test(source);\n}\nexports.hasCR = hasCR;\nfunction splitCR(source) {\n const matches = source.match(/\\r+$/);\n return matches == null\n ? ['', source]\n : [source.slice(-matches[0].length), source.slice(0, -matches[0].length)];\n}\nexports.splitCR = splitCR;\nfunction splitSpace(source) {\n const matches = source.match(/^\\s+/);\n return matches == null\n ? ['', source]\n : [source.slice(0, matches[0].length), source.slice(matches[0].length)];\n}\nexports.splitSpace = splitSpace;\nfunction splitLines(source) {\n return source.split(/\\n/);\n}\nexports.splitLines = splitLines;\nfunction seedBlock(block = {}) {\n return Object.assign({ description: '', tags: [], source: [], problems: [] }, block);\n}\nexports.seedBlock = seedBlock;\nfunction seedSpec(spec = {}) {\n return Object.assign({ tag: '', name: '', type: '', optional: false, description: '', problems: [], source: [] }, spec);\n}\nexports.seedSpec = seedSpec;\nfunction seedTokens(tokens = {}) {\n return Object.assign({ start: '', delimiter: '', postDelimiter: '', tag: '', postTag: '', name: '', postName: '', type: '', postType: '', description: '', end: '', lineEnd: '' }, tokens);\n}\nexports.seedTokens = seedTokens;\n/**\n * Assures Block.tags[].source contains references to the Block.source items,\n * using Block.source as a source of truth. This is a counterpart of rewireSpecs\n * @param block parsed coments block\n */\nfunction rewireSource(block) {\n const source = block.source.reduce((acc, line) => acc.set(line.number, line), new Map());\n for (const spec of block.tags) {\n spec.source = spec.source.map((line) => source.get(line.number));\n }\n return block;\n}\nexports.rewireSource = rewireSource;\n/**\n * Assures Block.source contains references to the Block.tags[].source items,\n * using Block.tags[].source as a source of truth. This is a counterpart of rewireSource\n * @param block parsed coments block\n */\nfunction rewireSpecs(block) {\n const source = block.tags.reduce((acc, spec) => spec.source.reduce((acc, line) => acc.set(line.number, line), acc), new Map());\n block.source = block.source.map((line) => source.get(line.number) || line);\n return block;\n}\nexports.rewireSpecs = rewireSpecs;\n"],"file":"util.cjs"}
|