@exercode/problem-utils 1.5.4 → 1.5.5

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.
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("../_virtual/_rollupPluginBabelHelpers.cjs"),r=require("node:fs"),n=require("node:path"),a=require("../types/decisionCode.cjs"),t=require("./findLanguageDefinitionByPath.cjs"),c=require("./removeCommentsInSourceCode.cjs");function o(){return(o=e.asyncToGenerator(e.regenerator().m(function o(s,i){var u,f,p,d,l,h,g,b,m,k,v,R,C,I,y,E,O,_,w,D,F,j,q,x,S,T,H,P,B,N,A,L,M,G;return e.regenerator().w(function(o){for(;;)switch(o.p=o.n){case 0:return f=[],A=e.createForOfIteratorHelper,o.n=1,r.promises.readdir(s,{withFileTypes:!0,recursive:!0});case 1:p=A(o.v),o.p=2,p.s();case 3:if((d=p.n()).done){o.n=9;break}if((l=d.value).isFile()){o.n=4;break}return o.a(3,8);case 4:return o.n=5,r.promises.readFile(n.join(l.parentPath,l.name),"utf8");case 5:if(h=o.v,!h.includes("�")){o.n=6;break}return o.a(3,8);case 6:if(g=t.findLanguageDefinitionByPath(l.name)){o.n=7;break}return o.a(3,8);case 7:f.push({path:l.name,data:g.grammer?c.removeCommentsInSourceCode(g.grammer,h):h});case 8:o.n=3;break;case 9:o.n=11;break;case 10:o.p=10,L=o.v,p.e(L);case 11:return o.p=11,p.f(),o.f(11);case 12:b=[],m=0,k=f;case 13:if(!(m<k.length)){o.n=23;break}C=k[m],I=e.createForOfIteratorHelper(null!=(v=i.forbiddenRegExpsInCode)?v:[]);try{for(I.s();!(y=I.n()).done;){E=y.value,O=new RegExp(E,"g"),_=C.data.matchAll(O),w=e.createForOfIteratorHelper(_);try{for(w.s();!(D=w.n()).done;)F=D.value,b.push({pattern:O.toString(),path:C.path,match:F[0]})}catch(e){w.e(e)}finally{w.f()}}}catch(e){I.e(e)}finally{I.f()}j=e.createForOfIteratorHelper(null!=(R=i.forbiddenTextsInCode)?R:[]),o.p=14,j.s();case 15:if((q=j.n()).done){o.n=19;break}x=q.value,S=0;case 16:if(!(S<C.data.length)){o.n=18;break}if(-1!==(T=C.data.indexOf(x,S))){o.n=17;break}return o.a(3,18);case 17:b.push({pattern:x,path:C.path,match:x}),S=T+x.length,o.n=16;break;case 18:o.n=15;break;case 19:o.n=21;break;case 20:o.p=20,M=o.v,j.e(M);case 21:return o.p=21,j.f(),o.f(21);case 22:m++,o.n=13;break;case 23:if(!(b.length>0)){o.n=24;break}return o.a(2,{decisionCode:a.DecisionCode.FORBIDDEN_PATTERNS_IN_CODE_ERROR,feedbackMarkdown:"ソースコード中に禁止された文字列が含まれています。\nソースコードを修正してから再度提出してください。\n\n| ファイル | 禁止パターン | 文字列 |\n| -------- | ------------ | ------ |\n".concat(b.map(function(e){return"| `".concat(e.path,"` | `").concat(e.pattern,"` | `").concat(e.match,"` |")}).join("\n"),"\n")});case 24:H=[],P=e.createForOfIteratorHelper(null!=(u=i.requiredRegExpsInCode)?u:[]),o.p=25,N=e.regenerator().m(function r(){var n,a;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:n=B.value,a=new RegExp(n),f.some(function(e){return a.test(e.data)})||H.push(a.toString());case 1:return e.a(2)}},r)}),P.s();case 26:if((B=P.n()).done){o.n=28;break}return o.d(e.regeneratorValues(N()),27);case 27:o.n=26;break;case 28:o.n=30;break;case 29:o.p=29,G=o.v,P.e(G);case 30:return o.p=30,P.f(),o.f(30);case 31:if(!(H.length>0)){o.n=32;break}return o.a(2,{decisionCode:a.DecisionCode.REQUIRED_PATTERNS_IN_CODE_ERROR,feedbackMarkdown:"ソースコード中に必要な文字列が含まれていません。\nソースコードを修正してから再度提出してください。\n\n".concat(H.map(function(e){return"- `".concat(e,"`")}).join("\n"),"\n")});case 32:return o.a(2)}},o,null,[[25,29,30,31],[14,20,21,22],[2,10,11,12]])}))).apply(this,arguments)}exports.judgeByStaticAnalysis=function(e,r){return o.apply(this,arguments)};
1
+ "use strict";var e=require("../_virtual/_rollupPluginBabelHelpers.cjs"),n=require("node:fs"),r=require("node:path"),a=require("../types/decisionCode.cjs"),t=require("./findLanguageDefinitionByPath.cjs"),c=require("./removeCommentsInSourceCode.cjs");function o(){return(o=e.asyncToGenerator(e.regenerator().m(function o(i,s){var u,f,d,p,l,h,b,m,k,g,I,R,v,E,C,S,_,y,O,F,w,D,j,q,P,x,N,T,B,H,M,A,L,U,G,Q,V;return e.regenerator().w(function(o){for(;;)switch(o.p=o.n){case 0:return f=new Set,d=[],U=e.createForOfIteratorHelper,o.n=1,n.promises.readdir(i,{withFileTypes:!0,recursive:!0});case 1:p=U(o.v),o.p=2,p.s();case 3:if((l=p.n()).done){o.n=9;break}if((h=l.value).isFile()){o.n=4;break}return o.a(3,8);case 4:return b=r.relative(i,r.join(h.parentPath,h.name)),f.add(b),o.n=5,n.promises.readFile(r.join(h.parentPath,h.name),"utf8");case 5:if(m=o.v,!m.includes("�")){o.n=6;break}return o.a(3,8);case 6:if(k=t.findLanguageDefinitionByPath(h.name)){o.n=7;break}return o.a(3,8);case 7:d.push({path:h.name,data:k.grammer?c.removeCommentsInSourceCode(k.grammer,m):m});case 8:o.n=3;break;case 9:o.n=11;break;case 10:o.p=10,G=o.v,p.e(G);case 11:return o.p=11,p.f(),o.f(11);case 12:if(!s.requiredSubmissionFilePaths){o.n=13;break}if(g=s.requiredSubmissionFilePaths.filter(function(e){return!f.has(e)}).toSorted(),!(g.length>0)){o.n=13;break}return o.a(2,{decisionCode:a.DecisionCode.MISSING_REQUIRED_SUBMISSION_FILE_ERROR,feedbackMarkdown:"ファイルが不足しています。\n次のファイルを追加してから再度提出してください。\n\n".concat(g.map(function(e){return"- `".concat(e,"`")}).join("\n"),"\n")});case 13:I=[],R=0,v=d;case 14:if(!(R<v.length)){o.n=24;break}S=v[R],_=e.createForOfIteratorHelper(null!=(E=s.forbiddenRegExpsInCode)?E:[]);try{for(_.s();!(y=_.n()).done;){O=y.value,F=new RegExp(O,"g"),w=S.data.matchAll(F),D=e.createForOfIteratorHelper(w);try{for(D.s();!(j=D.n()).done;)q=j.value,I.push({pattern:F.toString(),path:S.path,match:q[0]})}catch(e){D.e(e)}finally{D.f()}}}catch(e){_.e(e)}finally{_.f()}P=e.createForOfIteratorHelper(null!=(C=s.forbiddenTextsInCode)?C:[]),o.p=15,P.s();case 16:if((x=P.n()).done){o.n=20;break}N=x.value,T=0;case 17:if(!(T<S.data.length)){o.n=19;break}if(-1!==(B=S.data.indexOf(N,T))){o.n=18;break}return o.a(3,19);case 18:I.push({pattern:N,path:S.path,match:N}),T=B+N.length,o.n=17;break;case 19:o.n=16;break;case 20:o.n=22;break;case 21:o.p=21,Q=o.v,P.e(Q);case 22:return o.p=22,P.f(),o.f(22);case 23:R++,o.n=14;break;case 24:if(!(I.length>0)){o.n=25;break}return o.a(2,{decisionCode:a.DecisionCode.FORBIDDEN_PATTERNS_IN_CODE_ERROR,feedbackMarkdown:"ソースコード中に禁止された文字列が含まれています。\nソースコードを修正してから再度提出してください。\n\n| ファイル | 禁止パターン | 文字列 |\n| -------- | ------------ | ------ |\n".concat(I.map(function(e){return"| `".concat(e.path,"` | `").concat(e.pattern,"` | `").concat(e.match,"` |")}).join("\n"),"\n")});case 25:H=[],M=e.createForOfIteratorHelper(null!=(u=s.requiredRegExpsInCode)?u:[]),o.p=26,L=e.regenerator().m(function n(){var r,a;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:r=A.value,a=new RegExp(r),d.some(function(e){return a.test(e.data)})||H.push(a.toString());case 1:return e.a(2)}},n)}),M.s();case 27:if((A=M.n()).done){o.n=29;break}return o.d(e.regeneratorValues(L()),28);case 28:o.n=27;break;case 29:o.n=31;break;case 30:o.p=30,V=o.v,M.e(V);case 31:return o.p=31,M.f(),o.f(31);case 32:if(!(H.length>0)){o.n=33;break}return o.a(2,{decisionCode:a.DecisionCode.REQUIRED_PATTERNS_IN_CODE_ERROR,feedbackMarkdown:"ソースコード中に必要な文字列が含まれていません。\nソースコードを修正してから再度提出してください。\n\n".concat(H.map(function(e){return"- `".concat(e,"`")}).join("\n"),"\n")});case 33:return o.a(2)}},o,null,[[26,30,31,32],[15,21,22,23],[2,10,11,12]])}))).apply(this,arguments)}exports.judgeByStaticAnalysis=function(e,n){return o.apply(this,arguments)};
2
2
  //# sourceMappingURL=judgeByStaticAnalysis.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"judgeByStaticAnalysis.cjs","sources":["../../src/helpers/judgeByStaticAnalysis.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { DecisionCode } from '../types/decisionCode.js';\nimport type { ProblemMarkdownFrontMatter } from '../types/problem.js';\nimport type { TestCaseResult } from '../types/testCaseResult.js';\n\nimport { findLanguageDefinitionByPath } from './findLanguageDefinitionByPath.js';\nimport { removeCommentsInSourceCode } from './removeCommentsInSourceCode.js';\n\nexport async function judgeByStaticAnalysis(\n cwd: string,\n problemMarkdownFrontMatterLike: Pick<\n ProblemMarkdownFrontMatter,\n 'forbiddenRegExpsInCode' | 'forbiddenTextsInCode' | 'requiredRegExpsInCode'\n >\n): Promise<Pick<TestCaseResult, 'decisionCode' | 'feedbackMarkdown'> | undefined> {\n const sourceCodeWithoutCommentFiles: { path: string; data: string }[] = [];\n\n for (const dirent of await fs.promises.readdir(cwd, { withFileTypes: true, recursive: true })) {\n if (!dirent.isFile()) continue;\n\n const text = await fs.promises.readFile(path.join(dirent.parentPath, dirent.name), 'utf8');\n const isBinary = text.includes('\\uFFFD');\n if (isBinary) continue;\n\n const languageDefinition = findLanguageDefinitionByPath(dirent.name);\n if (!languageDefinition) continue;\n\n sourceCodeWithoutCommentFiles.push({\n path: dirent.name,\n data: languageDefinition.grammer ? removeCommentsInSourceCode(languageDefinition.grammer, text) : text,\n });\n }\n\n const forbiddenFounds: { pattern: string; path: string; match: string }[] = [];\n\n for (const file of sourceCodeWithoutCommentFiles) {\n for (const pattern of problemMarkdownFrontMatterLike.forbiddenRegExpsInCode ?? []) {\n const re = new RegExp(pattern, 'g');\n const mathces = file.data.matchAll(re);\n for (const match of mathces) forbiddenFounds.push({ pattern: re.toString(), path: file.path, match: match[0] });\n }\n for (const pattern of problemMarkdownFrontMatterLike.forbiddenTextsInCode ?? []) {\n let p = 0;\n while (p < file.data.length) {\n const index = file.data.indexOf(pattern, p);\n if (index === -1) break;\n forbiddenFounds.push({ pattern, path: file.path, match: pattern });\n p = index + pattern.length;\n }\n }\n }\n\n if (forbiddenFounds.length > 0) {\n return {\n decisionCode: DecisionCode.FORBIDDEN_PATTERNS_IN_CODE_ERROR,\n feedbackMarkdown: `ソースコード中に禁止された文字列が含まれています。\nソースコードを修正してから再度提出してください。\n\n| ファイル | 禁止パターン | 文字列 |\n| -------- | ------------ | ------ |\n${forbiddenFounds.map((f) => `| \\`${f.path}\\` | \\`${f.pattern}\\` | \\`${f.match}\\` |`).join('\\n')}\n`,\n };\n }\n\n const missingRequiredPatterns: string[] = [];\n\n for (const pattern of problemMarkdownFrontMatterLike.requiredRegExpsInCode ?? []) {\n const re = new RegExp(pattern);\n const isFound = sourceCodeWithoutCommentFiles.some((f) => re.test(f.data));\n if (!isFound) missingRequiredPatterns.push(re.toString());\n }\n\n if (missingRequiredPatterns.length > 0) {\n return {\n decisionCode: DecisionCode.REQUIRED_PATTERNS_IN_CODE_ERROR,\n feedbackMarkdown: `ソースコード中に必要な文字列が含まれていません。\nソースコードを修正してから再度提出してください。\n\n${missingRequiredPatterns.map((p) => `- \\`${p}\\``).join('\\n')}\n`,\n };\n }\n\n return;\n}\n"],"names":["_judgeByStaticAnalysis","_asyncToGenerator","_regenerator","m","_callee","cwd","problemMarkdownFrontMatterLike","_problemMarkdownFront3","sourceCodeWithoutCommentFiles","_iterator","_step","dirent","text","languageDefinition","forbiddenFounds","_i","_sourceCodeWithoutCom","_problemMarkdownFront","_problemMarkdownFront2","file","_iterator2","_step2","pattern","re","mathces","_iterator4","_step4","match","_iterator3","_step3","_pattern","p","index","missingRequiredPatterns","_iterator5","_step5","_loop","_t","_t2","_t3","_t4","w","_context2","n","_createForOfIteratorHelper","fs","promises","readdir","withFileTypes","recursive","v","s","done","value","isFile","a","readFile","path","join","parentPath","name","includes","findLanguageDefinitionByPath","push","data","grammer","removeCommentsInSourceCode","e","f","length","forbiddenRegExpsInCode","RegExp","matchAll","toString","err","forbiddenTextsInCode","indexOf","decisionCode","DecisionCode","FORBIDDEN_PATTERNS_IN_CODE_ERROR","feedbackMarkdown","concat","map","requiredRegExpsInCode","_context","some","test","d","_regeneratorValues","REQUIRED_PATTERNS_IN_CODE_ERROR","apply","this","arguments","_x","_x2"],"mappings":"yPAuFC,SAAAA,IAAA,OAAAA,EAAAC,EAAAA,iBAAAC,gBAAAC,EA7EM,SAAAC,EACLC,EACAC,GAGC,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAA,OAAAtC,gBAAAuC,EAAA,SAAAC,GAAA,cAAAA,EAAAX,EAAAW,EAAAC,GAAA,KAAA,EAEyE,OAApEnC,EAAkE,GAAE6B,EAAAO,EAAAA,0BAAAF,EAAAC,EAAA,EAE/CE,EAAGC,SAASC,QAAQ1C,EAAK,CAAE2C,eAAe,EAAMC,WAAW,IAAO,KAAA,EAAAxC,EAAA4B,EAAAK,EAAAQ,GAAAR,EAAAX,EAAA,EAAAtB,EAAA0C,IAAA,KAAA,EAAA,IAAAzC,EAAAD,EAAAkC,KAAAS,KAAA,CAAAV,EAAAC,EAAA,EAAA,KAAA,CAA5E,IAANhC,EAAMD,EAAA2C,OACHC,SAAQ,CAAAZ,EAAAC,EAAA,EAAA,KAAA,CAAA,OAAAD,EAAAa,EAAA,EAAA,GAAA,KAAA,EA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AA,EAC7B,CACLsB,aAAcC,EAAAA,aAAaW,gCAC3BT,iBAAgB,yDAAAC,OAGpBhD,EAAwBiD,IAAI,SAACnD,GAAC,MAAA,MAAAkD,OAAYlD,EAAC,IAAA,GAAM2B,KAAK,MAAK,QAExD,KAAA,GAAA,OAAAhB,EAAAa,EAAA,GAAA,EAAAnD,EAAA,KAAA,CAAA,CAAA,GAAA,GAAA,GAAA,IAAA,CAAA,GAAA,GAAA,GAAA,IAAA,CAAA,EAAA,GAAA,GAAA,KAAA,KAIJsF,MAAAC,KAAAC,UAAA,+BA7ED,SAA2CC,EAAAC,GAAA,OAAA9F,EAAA0F,MAAAC,KAAAC,UAAA"}
1
+ {"version":3,"file":"judgeByStaticAnalysis.cjs","sources":["../../src/helpers/judgeByStaticAnalysis.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { DecisionCode } from '../types/decisionCode.js';\nimport type { ProblemMarkdownFrontMatter } from '../types/problem.js';\nimport type { TestCaseResult } from '../types/testCaseResult.js';\n\nimport { findLanguageDefinitionByPath } from './findLanguageDefinitionByPath.js';\nimport { removeCommentsInSourceCode } from './removeCommentsInSourceCode.js';\n\nexport async function judgeByStaticAnalysis(\n cwd: string,\n problemMarkdownFrontMatterLike: Pick<\n ProblemMarkdownFrontMatter,\n 'forbiddenRegExpsInCode' | 'forbiddenTextsInCode' | 'requiredRegExpsInCode' | 'requiredSubmissionFilePaths'\n >\n): Promise<Pick<TestCaseResult, 'decisionCode' | 'feedbackMarkdown'> | undefined> {\n const filePathSet = new Set<string>();\n const sourceCodeWithoutCommentFiles: { path: string; data: string }[] = [];\n\n for (const dirent of await fs.promises.readdir(cwd, { withFileTypes: true, recursive: true })) {\n if (!dirent.isFile()) continue;\n\n const relativePath = path.relative(cwd, path.join(dirent.parentPath, dirent.name));\n filePathSet.add(relativePath);\n\n const text = await fs.promises.readFile(path.join(dirent.parentPath, dirent.name), 'utf8');\n const isBinary = text.includes('\\uFFFD');\n if (isBinary) continue;\n\n const languageDefinition = findLanguageDefinitionByPath(dirent.name);\n if (!languageDefinition) continue;\n\n sourceCodeWithoutCommentFiles.push({\n path: dirent.name,\n data: languageDefinition.grammer ? removeCommentsInSourceCode(languageDefinition.grammer, text) : text,\n });\n }\n\n if (problemMarkdownFrontMatterLike.requiredSubmissionFilePaths) {\n const missingFilePaths = problemMarkdownFrontMatterLike.requiredSubmissionFilePaths\n .filter((p) => !filePathSet.has(p))\n .toSorted();\n\n if (missingFilePaths.length > 0) {\n return {\n decisionCode: DecisionCode.MISSING_REQUIRED_SUBMISSION_FILE_ERROR,\n feedbackMarkdown: `ファイルが不足しています。\n次のファイルを追加してから再度提出してください。\n\n${missingFilePaths.map((p) => `- \\`${p}\\``).join('\\n')}\n`,\n };\n }\n }\n\n const forbiddenFounds: { pattern: string; path: string; match: string }[] = [];\n\n for (const file of sourceCodeWithoutCommentFiles) {\n for (const pattern of problemMarkdownFrontMatterLike.forbiddenRegExpsInCode ?? []) {\n const re = new RegExp(pattern, 'g');\n const mathces = file.data.matchAll(re);\n for (const match of mathces) forbiddenFounds.push({ pattern: re.toString(), path: file.path, match: match[0] });\n }\n for (const pattern of problemMarkdownFrontMatterLike.forbiddenTextsInCode ?? []) {\n let p = 0;\n while (p < file.data.length) {\n const index = file.data.indexOf(pattern, p);\n if (index === -1) break;\n forbiddenFounds.push({ pattern, path: file.path, match: pattern });\n p = index + pattern.length;\n }\n }\n }\n\n if (forbiddenFounds.length > 0) {\n return {\n decisionCode: DecisionCode.FORBIDDEN_PATTERNS_IN_CODE_ERROR,\n feedbackMarkdown: `ソースコード中に禁止された文字列が含まれています。\nソースコードを修正してから再度提出してください。\n\n| ファイル | 禁止パターン | 文字列 |\n| -------- | ------------ | ------ |\n${forbiddenFounds.map((f) => `| \\`${f.path}\\` | \\`${f.pattern}\\` | \\`${f.match}\\` |`).join('\\n')}\n`,\n };\n }\n\n const missingRequiredPatterns: string[] = [];\n\n for (const pattern of problemMarkdownFrontMatterLike.requiredRegExpsInCode ?? []) {\n const re = new RegExp(pattern);\n const isFound = sourceCodeWithoutCommentFiles.some((f) => re.test(f.data));\n if (!isFound) missingRequiredPatterns.push(re.toString());\n }\n\n if (missingRequiredPatterns.length > 0) {\n return {\n decisionCode: DecisionCode.REQUIRED_PATTERNS_IN_CODE_ERROR,\n feedbackMarkdown: `ソースコード中に必要な文字列が含まれていません。\nソースコードを修正してから再度提出してください。\n\n${missingRequiredPatterns.map((p) => `- \\`${p}\\``).join('\\n')}\n`,\n };\n }\n\n return;\n}\n"],"names":["_judgeByStaticAnalysis","_asyncToGenerator","_regenerator","m","_callee","cwd","problemMarkdownFrontMatterLike","_problemMarkdownFront3","filePathSet","sourceCodeWithoutCommentFiles","_iterator","_step","dirent","relativePath","text","languageDefinition","missingFilePaths","forbiddenFounds","_i","_sourceCodeWithoutCom","_problemMarkdownFront","_problemMarkdownFront2","file","_iterator2","_step2","pattern","re","mathces","_iterator4","_step4","match","_iterator3","_step3","_pattern","p","index","missingRequiredPatterns","_iterator5","_step5","_loop","_t","_t2","_t3","_t4","w","_context2","n","Set","_createForOfIteratorHelper","fs","promises","readdir","withFileTypes","recursive","v","s","done","value","isFile","a","path","relative","join","parentPath","name","add","readFile","includes","findLanguageDefinitionByPath","push","data","grammer","removeCommentsInSourceCode","e","f","requiredSubmissionFilePaths","filter","has","toSorted","length","decisionCode","DecisionCode","MISSING_REQUIRED_SUBMISSION_FILE_ERROR","feedbackMarkdown","concat","map","forbiddenRegExpsInCode","RegExp","matchAll","toString","err","forbiddenTextsInCode","indexOf","FORBIDDEN_PATTERNS_IN_CODE_ERROR","requiredRegExpsInCode","_context","some","test","d","_regeneratorValues","REQUIRED_PATTERNS_IN_CODE_ERROR","apply","this","arguments","_x","_x2"],"mappings":"yPA4GC,SAAAA,IAAA,OAAAA,EAAAC,EAAAA,iBAAAC,gBAAAC,EAlGM,SAAAC,EACLC,EACAC,GAGC,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,E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lC,EAAAC,EAAA,GAAA,KAAA,CAAA,OAAAD,EAAAc,EAAA,EAC7B,CACLqB,aAAcC,EAAAA,aAAamB,gCAC3BjB,iBAAgB,yDAAAC,OAGpBhD,EAAwBiD,IAAI,SAACnD,GAAC,MAAA,MAAAkD,OAAYlD,EAAC,IAAA,GAAM4B,KAAK,MAAK,QAExD,KAAA,GAAA,OAAAjB,EAAAc,EAAA,GAAA,EAAAvD,EAAA,KAAA,CAAA,CAAA,GAAA,GAAA,GAAA,IAAA,CAAA,GAAA,GAAA,GAAA,IAAA,CAAA,EAAA,GAAA,GAAA,KAAA,KAIJiG,MAAAC,KAAAC,UAAA,+BAlGD,SAA2CC,EAAAC,GAAA,OAAAzG,EAAAqG,MAAAC,KAAAC,UAAA"}
@@ -1,3 +1,3 @@
1
1
  import type { ProblemMarkdownFrontMatter } from '../types/problem.js';
2
2
  import type { TestCaseResult } from '../types/testCaseResult.js';
3
- export declare function judgeByStaticAnalysis(cwd: string, problemMarkdownFrontMatterLike: Pick<ProblemMarkdownFrontMatter, 'forbiddenRegExpsInCode' | 'forbiddenTextsInCode' | 'requiredRegExpsInCode'>): Promise<Pick<TestCaseResult, 'decisionCode' | 'feedbackMarkdown'> | undefined>;
3
+ export declare function judgeByStaticAnalysis(cwd: string, problemMarkdownFrontMatterLike: Pick<ProblemMarkdownFrontMatter, 'forbiddenRegExpsInCode' | 'forbiddenTextsInCode' | 'requiredRegExpsInCode' | 'requiredSubmissionFilePaths'>): Promise<Pick<TestCaseResult, 'decisionCode' | 'feedbackMarkdown'> | undefined>;
@@ -1,2 +1,2 @@
1
- import{asyncToGenerator as e,regenerator as n,regeneratorValues as a,createForOfIteratorHelper as r}from"../_virtual/_rollupPluginBabelHelpers.js";import t from"node:fs";import s from"node:path";import{DecisionCode as c}from"../types/decisionCode.js";import{findLanguageDefinitionByPath as o}from"./findLanguageDefinitionByPath.js";import{removeCommentsInSourceCode as i}from"./removeCommentsInSourceCode.js";function u(e,n){return f.apply(this,arguments)}function f(){return(f=e(n().m(function e(u,f){var p,d,l,m,h,b,k,g,v,R,E,y,C,_,w,I,j,x,O,T,D,F,N,P,S,A,B,H,M,q,G,L,Q,U;return n().w(function(e){for(;;)switch(e.p=e.n){case 0:return d=[],G=r,e.n=1,t.promises.readdir(u,{withFileTypes:!0,recursive:!0});case 1:l=G(e.v),e.p=2,l.s();case 3:if((m=l.n()).done){e.n=9;break}if((h=m.value).isFile()){e.n=4;break}return e.a(3,8);case 4:return e.n=5,t.promises.readFile(s.join(h.parentPath,h.name),"utf8");case 5:if(b=e.v,!b.includes("�")){e.n=6;break}return e.a(3,8);case 6:if(k=o(h.name)){e.n=7;break}return e.a(3,8);case 7:d.push({path:h.name,data:k.grammer?i(k.grammer,b):b});case 8:e.n=3;break;case 9:e.n=11;break;case 10:e.p=10,L=e.v,l.e(L);case 11:return e.p=11,l.f(),e.f(11);case 12:g=[],v=0,R=d;case 13:if(!(v<R.length)){e.n=23;break}C=R[v],_=r(null!=(E=f.forbiddenRegExpsInCode)?E:[]);try{for(_.s();!(w=_.n()).done;){I=w.value,j=new RegExp(I,"g"),x=C.data.matchAll(j),O=r(x);try{for(O.s();!(T=O.n()).done;)D=T.value,g.push({pattern:j.toString(),path:C.path,match:D[0]})}catch(e){O.e(e)}finally{O.f()}}}catch(e){_.e(e)}finally{_.f()}F=r(null!=(y=f.forbiddenTextsInCode)?y:[]),e.p=14,F.s();case 15:if((N=F.n()).done){e.n=19;break}P=N.value,S=0;case 16:if(!(S<C.data.length)){e.n=18;break}if(-1!==(A=C.data.indexOf(P,S))){e.n=17;break}return e.a(3,18);case 17:g.push({pattern:P,path:C.path,match:P}),S=A+P.length,e.n=16;break;case 18:e.n=15;break;case 19:e.n=21;break;case 20:e.p=20,Q=e.v,F.e(Q);case 21:return e.p=21,F.f(),e.f(21);case 22:v++,e.n=13;break;case 23:if(!(g.length>0)){e.n=24;break}return e.a(2,{decisionCode:c.FORBIDDEN_PATTERNS_IN_CODE_ERROR,feedbackMarkdown:"ソースコード中に禁止された文字列が含まれています。\nソースコードを修正してから再度提出してください。\n\n| ファイル | 禁止パターン | 文字列 |\n| -------- | ------------ | ------ |\n".concat(g.map(function(e){return"| `".concat(e.path,"` | `").concat(e.pattern,"` | `").concat(e.match,"` |")}).join("\n"),"\n")});case 24:B=[],H=r(null!=(p=f.requiredRegExpsInCode)?p:[]),e.p=25,q=n().m(function e(){var a,r;return n().w(function(e){for(;;)switch(e.n){case 0:a=M.value,r=new RegExp(a),d.some(function(e){return r.test(e.data)})||B.push(r.toString());case 1:return e.a(2)}},e)}),H.s();case 26:if((M=H.n()).done){e.n=28;break}return e.d(a(q()),27);case 27:e.n=26;break;case 28:e.n=30;break;case 29:e.p=29,U=e.v,H.e(U);case 30:return e.p=30,H.f(),e.f(30);case 31:if(!(B.length>0)){e.n=32;break}return e.a(2,{decisionCode:c.REQUIRED_PATTERNS_IN_CODE_ERROR,feedbackMarkdown:"ソースコード中に必要な文字列が含まれていません。\nソースコードを修正してから再度提出してください。\n\n".concat(B.map(function(e){return"- `".concat(e,"`")}).join("\n"),"\n")});case 32:return e.a(2)}},e,null,[[25,29,30,31],[14,20,21,22],[2,10,11,12]])}))).apply(this,arguments)}export{u as judgeByStaticAnalysis};
1
+ import{asyncToGenerator as e,regenerator as n,regeneratorValues as a,createForOfIteratorHelper as r}from"../_virtual/_rollupPluginBabelHelpers.js";import t from"node:fs";import o from"node:path";import{DecisionCode as s}from"../types/decisionCode.js";import{findLanguageDefinitionByPath as c}from"./findLanguageDefinitionByPath.js";import{removeCommentsInSourceCode as i}from"./removeCommentsInSourceCode.js";function u(e,n){return f.apply(this,arguments)}function f(){return(f=e(n().m(function e(u,f){var p,d,l,m,h,b,k,g,R,E,v,I,S,_,w,C,y,j,O,F,P,x,D,N,T,M,B,q,A,U,G,H,L,Q,V,z,J;return n().w(function(e){for(;;)switch(e.p=e.n){case 0:return d=new Set,l=[],Q=r,e.n=1,t.promises.readdir(u,{withFileTypes:!0,recursive:!0});case 1:m=Q(e.v),e.p=2,m.s();case 3:if((h=m.n()).done){e.n=9;break}if((b=h.value).isFile()){e.n=4;break}return e.a(3,8);case 4:return k=o.relative(u,o.join(b.parentPath,b.name)),d.add(k),e.n=5,t.promises.readFile(o.join(b.parentPath,b.name),"utf8");case 5:if(g=e.v,!g.includes("�")){e.n=6;break}return e.a(3,8);case 6:if(R=c(b.name)){e.n=7;break}return e.a(3,8);case 7:l.push({path:b.name,data:R.grammer?i(R.grammer,g):g});case 8:e.n=3;break;case 9:e.n=11;break;case 10:e.p=10,V=e.v,m.e(V);case 11:return e.p=11,m.f(),e.f(11);case 12:if(!f.requiredSubmissionFilePaths){e.n=13;break}if(E=f.requiredSubmissionFilePaths.filter(function(e){return!d.has(e)}).toSorted(),!(E.length>0)){e.n=13;break}return e.a(2,{decisionCode:s.MISSING_REQUIRED_SUBMISSION_FILE_ERROR,feedbackMarkdown:"ファイルが不足しています。\n次のファイルを追加してから再度提出してください。\n\n".concat(E.map(function(e){return"- `".concat(e,"`")}).join("\n"),"\n")});case 13:v=[],I=0,S=l;case 14:if(!(I<S.length)){e.n=24;break}C=S[I],y=r(null!=(_=f.forbiddenRegExpsInCode)?_:[]);try{for(y.s();!(j=y.n()).done;){O=j.value,F=new RegExp(O,"g"),P=C.data.matchAll(F),x=r(P);try{for(x.s();!(D=x.n()).done;)N=D.value,v.push({pattern:F.toString(),path:C.path,match:N[0]})}catch(e){x.e(e)}finally{x.f()}}}catch(e){y.e(e)}finally{y.f()}T=r(null!=(w=f.forbiddenTextsInCode)?w:[]),e.p=15,T.s();case 16:if((M=T.n()).done){e.n=20;break}B=M.value,q=0;case 17:if(!(q<C.data.length)){e.n=19;break}if(-1!==(A=C.data.indexOf(B,q))){e.n=18;break}return e.a(3,19);case 18:v.push({pattern:B,path:C.path,match:B}),q=A+B.length,e.n=17;break;case 19:e.n=16;break;case 20:e.n=22;break;case 21:e.p=21,z=e.v,T.e(z);case 22:return e.p=22,T.f(),e.f(22);case 23:I++,e.n=14;break;case 24:if(!(v.length>0)){e.n=25;break}return e.a(2,{decisionCode:s.FORBIDDEN_PATTERNS_IN_CODE_ERROR,feedbackMarkdown:"ソースコード中に禁止された文字列が含まれています。\nソースコードを修正してから再度提出してください。\n\n| ファイル | 禁止パターン | 文字列 |\n| -------- | ------------ | ------ |\n".concat(v.map(function(e){return"| `".concat(e.path,"` | `").concat(e.pattern,"` | `").concat(e.match,"` |")}).join("\n"),"\n")});case 25:U=[],G=r(null!=(p=f.requiredRegExpsInCode)?p:[]),e.p=26,L=n().m(function e(){var a,r;return n().w(function(e){for(;;)switch(e.n){case 0:a=H.value,r=new RegExp(a),l.some(function(e){return r.test(e.data)})||U.push(r.toString());case 1:return e.a(2)}},e)}),G.s();case 27:if((H=G.n()).done){e.n=29;break}return e.d(a(L()),28);case 28:e.n=27;break;case 29:e.n=31;break;case 30:e.p=30,J=e.v,G.e(J);case 31:return e.p=31,G.f(),e.f(31);case 32:if(!(U.length>0)){e.n=33;break}return e.a(2,{decisionCode:s.REQUIRED_PATTERNS_IN_CODE_ERROR,feedbackMarkdown:"ソースコード中に必要な文字列が含まれていません。\nソースコードを修正してから再度提出してください。\n\n".concat(U.map(function(e){return"- `".concat(e,"`")}).join("\n"),"\n")});case 33:return e.a(2)}},e,null,[[26,30,31,32],[15,21,22,23],[2,10,11,12]])}))).apply(this,arguments)}export{u as judgeByStaticAnalysis};
2
2
  //# sourceMappingURL=judgeByStaticAnalysis.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"judgeByStaticAnalysis.js","sources":["../../src/helpers/judgeByStaticAnalysis.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { DecisionCode } from '../types/decisionCode.js';\nimport type { ProblemMarkdownFrontMatter } from '../types/problem.js';\nimport type { TestCaseResult } from '../types/testCaseResult.js';\n\nimport { findLanguageDefinitionByPath } from './findLanguageDefinitionByPath.js';\nimport { removeCommentsInSourceCode } from './removeCommentsInSourceCode.js';\n\nexport async function judgeByStaticAnalysis(\n cwd: string,\n problemMarkdownFrontMatterLike: Pick<\n ProblemMarkdownFrontMatter,\n 'forbiddenRegExpsInCode' | 'forbiddenTextsInCode' | 'requiredRegExpsInCode'\n >\n): Promise<Pick<TestCaseResult, 'decisionCode' | 'feedbackMarkdown'> | undefined> {\n const sourceCodeWithoutCommentFiles: { path: string; data: string }[] = [];\n\n for (const dirent of await fs.promises.readdir(cwd, { withFileTypes: true, recursive: true })) {\n if (!dirent.isFile()) continue;\n\n const text = await fs.promises.readFile(path.join(dirent.parentPath, dirent.name), 'utf8');\n const isBinary = text.includes('\\uFFFD');\n if (isBinary) continue;\n\n const languageDefinition = findLanguageDefinitionByPath(dirent.name);\n if (!languageDefinition) continue;\n\n sourceCodeWithoutCommentFiles.push({\n path: dirent.name,\n data: languageDefinition.grammer ? removeCommentsInSourceCode(languageDefinition.grammer, text) : text,\n });\n }\n\n const forbiddenFounds: { pattern: string; path: string; match: string }[] = [];\n\n for (const file of sourceCodeWithoutCommentFiles) {\n for (const pattern of problemMarkdownFrontMatterLike.forbiddenRegExpsInCode ?? []) {\n const re = new RegExp(pattern, 'g');\n const mathces = file.data.matchAll(re);\n for (const match of mathces) forbiddenFounds.push({ pattern: re.toString(), path: file.path, match: match[0] });\n }\n for (const pattern of problemMarkdownFrontMatterLike.forbiddenTextsInCode ?? []) {\n let p = 0;\n while (p < file.data.length) {\n const index = file.data.indexOf(pattern, p);\n if (index === -1) break;\n forbiddenFounds.push({ pattern, path: file.path, match: pattern });\n p = index + pattern.length;\n }\n }\n }\n\n if (forbiddenFounds.length > 0) {\n return {\n decisionCode: DecisionCode.FORBIDDEN_PATTERNS_IN_CODE_ERROR,\n feedbackMarkdown: `ソースコード中に禁止された文字列が含まれています。\nソースコードを修正してから再度提出してください。\n\n| ファイル | 禁止パターン | 文字列 |\n| -------- | ------------ | ------ |\n${forbiddenFounds.map((f) => `| \\`${f.path}\\` | \\`${f.pattern}\\` | \\`${f.match}\\` |`).join('\\n')}\n`,\n };\n }\n\n const missingRequiredPatterns: string[] = [];\n\n for (const pattern of problemMarkdownFrontMatterLike.requiredRegExpsInCode ?? []) {\n const re = new RegExp(pattern);\n const isFound = sourceCodeWithoutCommentFiles.some((f) => re.test(f.data));\n if (!isFound) missingRequiredPatterns.push(re.toString());\n }\n\n if (missingRequiredPatterns.length > 0) {\n return {\n decisionCode: DecisionCode.REQUIRED_PATTERNS_IN_CODE_ERROR,\n feedbackMarkdown: `ソースコード中に必要な文字列が含まれていません。\nソースコードを修正してから再度提出してください。\n\n${missingRequiredPatterns.map((p) => `- \\`${p}\\``).join('\\n')}\n`,\n };\n }\n\n return;\n}\n"],"names":["judgeByStaticAnalysis","_x","_x2","_judgeByStaticAnalysis","apply","this","arguments","_asyncToGenerator","_regenerator","m","_callee","cwd","problemMarkdownFrontMatterLike","_problemMarkdownFront3","sourceCodeWithoutCommentFiles","_iterator","_step","dirent","text","languageDefinition","forbiddenFounds","_i","_sourceCodeWithoutCom","_problemMarkdownFront","_problemMarkdownFront2","file","_iterator2","_step2","pattern","re","mathces","_iterator4","_step4","match","_iterator3","_step3","_pattern","p","index","missingRequiredPatterns","_iterator5","_step5","_loop","_t","_t2","_t3","_t4","w","_context2","n","_createForOfIteratorHelper","fs","promises","readdir","withFileTypes","recursive","v","s","done","value","isFile","a","readFile","path","join","parentPath","name","includes","findLanguageDefinitionByPath","push","data","grammer","removeCommentsInSourceCode","e","f","length","forbiddenRegExpsInCode","RegExp","matchAll","toString","err","forbiddenTextsInCode","indexOf","decisionCode","DecisionCode","FORBIDDEN_PATTERNS_IN_CODE_ERROR","feedbackMarkdown","concat","map","requiredRegExpsInCode","_context","some","test","d","_regeneratorValues","REQUIRED_PATTERNS_IN_CODE_ERROR"],"mappings":"yZAUA,SAAsBA,EAAqBC,EAAAC,GAAA,OAAAC,EAAAC,MAAAC,KAAAC,UAAA,CA6E1C,SAAAH,IAAA,OAAAA,EAAAI,EAAAC,IAAAC,EA7EM,SAAAC,EACLC,EACAC,GAGC,IAAAC,E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AAOjD,GACNd,EAA8B6E,KAAK,SAACjB,GAAC,OAAK7C,EAAG+D,KAAKlB,EAAEJ,KAAK,IAC3D/B,EAAwB8B,KAAKxC,EAAGkD,YAAY,KAAA,EAAA,OAAAW,EAAA7B,EAAA,GAAA,EAAAnB,EAAA,GAAAF,EAAAiB,IAAA,KAAA,GAAA,IAAAhB,EAAAD,EAAAS,KAAAS,KAAA,CAAAV,EAAAC,EAAA,GAAA,KAAA,CAAA,OAAAD,EAAA6C,EAAAC,EAAApD,KAAA,IAAA,KAAA,GAAAM,EAAAC,EAAA,GAAA,MAAA,KAAA,GAAAD,EAAAC,EAAA,GAAA,MAAA,KAAA,GAAAD,EAAAX,EAAA,GAAAS,EAAAE,EAAAQ,EAAAhB,EAAAiC,EAAA3B,GAAA,KAAA,GAAA,OAAAE,EAAAX,EAAA,GAAAG,EAAAkC,IAAA1B,EAAA0B,EAAA,IAAA,KAAA,GAAA,KAGxDnC,EAAwBoC,OAAS,GAAC,CAAA3B,EAAAC,EAAA,GAAA,KAAA,CAAA,OAAAD,EAAAa,EAAA,EAC7B,CACLsB,aAAcC,EAAaW,gCAC3BT,iBAAgB,yDAAAC,OAGpBhD,EAAwBiD,IAAI,SAACnD,GAAC,MAAA,MAAAkD,OAAYlD,EAAC,IAAA,GAAM2B,KAAK,MAAK,QAExD,KAAA,GAAA,OAAAhB,EAAAa,EAAA,GAAA,EAAAnD,EAAA,KAAA,CAAA,CAAA,GAAA,GAAA,GAAA,IAAA,CAAA,GAAA,GAAA,GAAA,IAAA,CAAA,EAAA,GAAA,GAAA,KAAA,KAIJN,MAAAC,KAAAC,UAAA"}
1
+ {"version":3,"file":"judgeByStaticAnalysis.js","sources":["../../src/helpers/judgeByStaticAnalysis.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { DecisionCode } from '../types/decisionCode.js';\nimport type { ProblemMarkdownFrontMatter } from '../types/problem.js';\nimport type { TestCaseResult } from '../types/testCaseResult.js';\n\nimport { findLanguageDefinitionByPath } from './findLanguageDefinitionByPath.js';\nimport { removeCommentsInSourceCode } from './removeCommentsInSourceCode.js';\n\nexport async function judgeByStaticAnalysis(\n cwd: string,\n problemMarkdownFrontMatterLike: Pick<\n ProblemMarkdownFrontMatter,\n 'forbiddenRegExpsInCode' | 'forbiddenTextsInCode' | 'requiredRegExpsInCode' | 'requiredSubmissionFilePaths'\n >\n): Promise<Pick<TestCaseResult, 'decisionCode' | 'feedbackMarkdown'> | undefined> {\n const filePathSet = new Set<string>();\n const sourceCodeWithoutCommentFiles: { path: string; data: string }[] = [];\n\n for (const dirent of await fs.promises.readdir(cwd, { withFileTypes: true, recursive: true })) {\n if (!dirent.isFile()) continue;\n\n const relativePath = path.relative(cwd, path.join(dirent.parentPath, dirent.name));\n filePathSet.add(relativePath);\n\n const text = await fs.promises.readFile(path.join(dirent.parentPath, dirent.name), 'utf8');\n const isBinary = text.includes('\\uFFFD');\n if (isBinary) continue;\n\n const languageDefinition = findLanguageDefinitionByPath(dirent.name);\n if (!languageDefinition) continue;\n\n sourceCodeWithoutCommentFiles.push({\n path: dirent.name,\n data: languageDefinition.grammer ? removeCommentsInSourceCode(languageDefinition.grammer, text) : text,\n });\n }\n\n if (problemMarkdownFrontMatterLike.requiredSubmissionFilePaths) {\n const missingFilePaths = problemMarkdownFrontMatterLike.requiredSubmissionFilePaths\n .filter((p) => !filePathSet.has(p))\n .toSorted();\n\n if (missingFilePaths.length > 0) {\n return {\n decisionCode: DecisionCode.MISSING_REQUIRED_SUBMISSION_FILE_ERROR,\n feedbackMarkdown: `ファイルが不足しています。\n次のファイルを追加してから再度提出してください。\n\n${missingFilePaths.map((p) => `- \\`${p}\\``).join('\\n')}\n`,\n };\n }\n }\n\n const forbiddenFounds: { pattern: string; path: string; match: string }[] = [];\n\n for (const file of sourceCodeWithoutCommentFiles) {\n for (const pattern of problemMarkdownFrontMatterLike.forbiddenRegExpsInCode ?? []) {\n const re = new RegExp(pattern, 'g');\n const mathces = file.data.matchAll(re);\n for (const match of mathces) forbiddenFounds.push({ pattern: re.toString(), path: file.path, match: match[0] });\n }\n for (const pattern of problemMarkdownFrontMatterLike.forbiddenTextsInCode ?? []) {\n let p = 0;\n while (p < file.data.length) {\n const index = file.data.indexOf(pattern, p);\n if (index === -1) break;\n forbiddenFounds.push({ pattern, path: file.path, match: pattern });\n p = index + pattern.length;\n }\n }\n }\n\n if (forbiddenFounds.length > 0) {\n return {\n decisionCode: DecisionCode.FORBIDDEN_PATTERNS_IN_CODE_ERROR,\n feedbackMarkdown: `ソースコード中に禁止された文字列が含まれています。\nソースコードを修正してから再度提出してください。\n\n| ファイル | 禁止パターン | 文字列 |\n| -------- | ------------ | ------ |\n${forbiddenFounds.map((f) => `| \\`${f.path}\\` | \\`${f.pattern}\\` | \\`${f.match}\\` |`).join('\\n')}\n`,\n };\n }\n\n const missingRequiredPatterns: string[] = [];\n\n for (const pattern of problemMarkdownFrontMatterLike.requiredRegExpsInCode ?? []) {\n const re = new RegExp(pattern);\n const isFound = sourceCodeWithoutCommentFiles.some((f) => re.test(f.data));\n if (!isFound) missingRequiredPatterns.push(re.toString());\n }\n\n if (missingRequiredPatterns.length > 0) {\n return {\n decisionCode: DecisionCode.REQUIRED_PATTERNS_IN_CODE_ERROR,\n feedbackMarkdown: `ソースコード中に必要な文字列が含まれていません。\nソースコードを修正してから再度提出してください。\n\n${missingRequiredPatterns.map((p) => `- \\`${p}\\``).join('\\n')}\n`,\n };\n }\n\n return;\n}\n"],"names":["judgeByStaticAnalysis","_x","_x2","_judgeByStaticAnalysis","apply","this","arguments","_asyncToGenerator","_regenerator","m","_callee","cwd","problemMarkdownFrontMatterLike","_problemMarkdownFront3","filePathSet","sourceCodeWithoutCommentFiles","_iterator","_step","dirent","relativePath","text","languageDefinition","missingFilePaths","forbiddenFounds","_i","_sourceCodeWithoutCom","_problemMarkdownFront","_problemMarkdownFront2","file","_iterator2","_step2","pattern","re","mathces","_iterator4","_step4","match","_iterator3","_step3","_pattern","p","index","missingRequiredPatterns","_iterator5","_step5","_loop","_t","_t2","_t3","_t4","w","_context2","n","Set","_createForOfIteratorHelper","fs","promises","readdir","withFileTypes","recursive","v","s","done","value","isFile","a","path","relative","join","parentPath","name","add","readFile","includes","findLanguageDefinitionByPath","push","data","grammer","removeCommentsInSourceCode","e","f","requiredSubmissionFilePaths","filter","has","toSorted","length","decisionCode","DecisionCode","MISSING_REQUIRED_SUBMISSION_FILE_ERROR","feedbackMarkdown","concat","map","forbiddenRegExpsInCode","RegExp","matchAll","toString","err","forbiddenTextsInCode","indexOf","FORBIDDEN_PATTERNS_IN_CODE_ERROR","requiredRegExpsInCode","_context","some","test","d","_regeneratorValues","REQUIRED_PATTERNS_IN_CODE_ERROR"],"mappings":"yZAUA,SAAsBA,EAAqBC,EAAAC,GAAA,OAAAC,EAAAC,MAAAC,KAAAC,UAAA,CAkG1C,SAAAH,IAAA,OAAAA,EAAAI,EAAAC,IAAAC,EAlGM,SAAAC,EACLC,EACAC,GAGC,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAA,OAAAzC,IAAA0C,EAAA,SAAAC,GAAA,cAAAA,EAAAX,EAAAW,EAAAC,GAAA,KAAA,EAGyE,OADpEtC,EAAc,IAAIuC,IAClBtC,EAAkE,GAAE+B,EAAAQ,EAAAH,EAAAC,EAAA,EAE/CG,EAAGC,SAASC,QAAQ9C,EAAK,CAAE+C,eAAe,EAAMC,WAAW,IAAO,KAAA,EAAA3C,EAAA8B,EAAAK,EAAAS,GAAAT,EAAAX,EAAA,EAAAxB,EAAA6C,IAAA,KAAA,EAAA,IAAA5C,EAAAD,EAAAoC,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AAC,OAAKhD,EAAGuE,KAAKvB,EAAEJ,KAAK,IAC3DlC,EAAwBiC,KAAK3C,EAAG+D,YAAY,KAAA,EAAA,OAAAM,EAAApC,EAAA,GAAA,EAAApB,EAAA,GAAAF,EAAAkB,IAAA,KAAA,GAAA,IAAAjB,EAAAD,EAAAS,KAAAU,KAAA,CAAAX,EAAAC,EAAA,GAAA,KAAA,CAAA,OAAAD,EAAAqD,EAAAC,EAAA5D,KAAA,IAAA,KAAA,GAAAM,EAAAC,EAAA,GAAA,MAAA,KAAA,GAAAD,EAAAC,EAAA,GAAA,MAAA,KAAA,GAAAD,EAAAX,EAAA,GAAAS,EAAAE,EAAAS,EAAAjB,EAAAoC,EAAA9B,GAAA,KAAA,GAAA,OAAAE,EAAAX,EAAA,GAAAG,EAAAqC,IAAA7B,EAAA6B,EAAA,IAAA,KAAA,GAAA,KAGxDtC,EAAwB2C,OAAS,GAAC,CAAAlC,EAAAC,EAAA,GAAA,KAAA,CAAA,OAAAD,EAAAc,EAAA,EAC7B,CACLqB,aAAcC,EAAamB,gCAC3BjB,iBAAgB,yDAAAC,OAGpBhD,EAAwBiD,IAAI,SAACnD,GAAC,MAAA,MAAAkD,OAAYlD,EAAC,IAAA,GAAM4B,KAAK,MAAK,QAExD,KAAA,GAAA,OAAAjB,EAAAc,EAAA,GAAA,EAAAvD,EAAA,KAAA,CAAA,CAAA,GAAA,GAAA,GAAA,IAAA,CAAA,GAAA,GAAA,GAAA,IAAA,CAAA,EAAA,GAAA,GAAA,KAAA,KAIJN,MAAAC,KAAAC,UAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exercode/problem-utils",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
4
4
  "description": ":100: A set of utilities for judging programs on Exercode (https://exercode.willbooster.com/).",
5
5
  "keywords": [
6
6
  "exercode",