@aws/cloudformation-languageserver 0.0.0 → 1.14.0

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 (75) hide show
  1. package/LICENSE +175 -0
  2. package/NOTICE +10 -0
  3. package/README.md +70 -3
  4. package/THIRD-PARTY-LICENSES.txt +15761 -0
  5. package/assets/featureFlag/alpha.json +57 -0
  6. package/assets/featureFlag/beta.json +56 -0
  7. package/assets/featureFlag/prod.json +56 -0
  8. package/assets/relationship_schemas.json +16282 -0
  9. package/assets/release-manifest.json +1115 -0
  10. package/assets/wheels/annotated_types-0.7.0-py3-none-any.whl +0 -0
  11. package/assets/wheels/attrs-26.1.0-py3-none-any.whl +0 -0
  12. package/assets/wheels/aws_sam_translator-1.109.0-py3-none-any.whl +0 -0
  13. package/assets/wheels/boto3-1.43.4-py3-none-any.whl +0 -0
  14. package/assets/wheels/botocore-1.43.4-py3-none-any.whl +0 -0
  15. package/assets/wheels/cfn_lint-1.57.0-py3-none-any.whl +0 -0
  16. package/assets/wheels/jmespath-1.1.0-py3-none-any.whl +0 -0
  17. package/assets/wheels/jsonpatch-1.33-py2.py3-none-any.whl +0 -0
  18. package/assets/wheels/jsonpointer-3.1.1-py3-none-any.whl +0 -0
  19. package/assets/wheels/jsonschema-4.26.0-py3-none-any.whl +0 -0
  20. package/assets/wheels/jsonschema_specifications-2025.9.1-py3-none-any.whl +0 -0
  21. package/assets/wheels/micropip-0.10.1-py3-none-any.whl +0 -0
  22. package/assets/wheels/mpmath-1.4.1-py3-none-any.whl +0 -0
  23. package/assets/wheels/networkx-3.6.1-py3-none-any.whl +0 -0
  24. package/assets/wheels/pydantic-2.10.6-py3-none-any.whl +0 -0
  25. package/assets/wheels/pydantic_core-2.27.2-cp313-cp313-pyodide_2025_0_wasm32.whl +0 -0
  26. package/assets/wheels/python_dateutil-2.9.0.post0-py2.py3-none-any.whl +0 -0
  27. package/assets/wheels/pyyaml-6.0.2-cp313-cp313-pyodide_2025_0_wasm32.whl +0 -0
  28. package/assets/wheels/referencing-0.37.0-py3-none-any.whl +0 -0
  29. package/assets/wheels/regex-2024.11.6-cp313-cp313-pyodide_2025_0_wasm32.whl +0 -0
  30. package/assets/wheels/rpds_py-0.23.1-cp313-cp313-pyodide_2025_0_wasm32.whl +0 -0
  31. package/assets/wheels/s3transfer-0.17.0-py3-none-any.whl +0 -0
  32. package/assets/wheels/six-1.17.0-py2.py3-none-any.whl +0 -0
  33. package/assets/wheels/sympy-1.14.0-py3-none-any.whl +0 -0
  34. package/assets/wheels/typing_extensions-4.15.0-py3-none-any.whl +0 -0
  35. package/assets/wheels/urllib3-2.7.0-py3-none-any.whl +0 -0
  36. package/cfn-lsp-server-standalone.js +45233 -0
  37. package/cfn-lsp-server-standalone.js.map +1 -0
  38. package/cfn-validate-worker.js +83 -0
  39. package/cfn-validate-worker.js.map +1 -0
  40. package/guard_bg.wasm +0 -0
  41. package/node_modules_aws-sdk_credential-provider-http_dist-es_index_js.js +225 -0
  42. package/node_modules_aws-sdk_credential-provider-http_dist-es_index_js.js.map +1 -0
  43. package/node_modules_aws-sdk_credential-provider-ini_dist-es_index_js.js +280 -0
  44. package/node_modules_aws-sdk_credential-provider-ini_dist-es_index_js.js.map +1 -0
  45. package/node_modules_aws-sdk_credential-provider-login_dist-es_index_js.js +329 -0
  46. package/node_modules_aws-sdk_credential-provider-login_dist-es_index_js.js.map +1 -0
  47. package/node_modules_aws-sdk_credential-provider-process_dist-es_index_js.js +111 -0
  48. package/node_modules_aws-sdk_credential-provider-process_dist-es_index_js.js.map +1 -0
  49. package/node_modules_aws-sdk_credential-provider-sso_dist-es_index_js.js +424 -0
  50. package/node_modules_aws-sdk_credential-provider-sso_dist-es_index_js.js.map +1 -0
  51. package/node_modules_aws-sdk_credential-provider-web-identity_dist-es_index_js.js +90 -0
  52. package/node_modules_aws-sdk_credential-provider-web-identity_dist-es_index_js.js.map +1 -0
  53. package/node_modules_smithy_credential-provider-imds_dist-es_index_js.js +437 -0
  54. package/node_modules_smithy_credential-provider-imds_dist-es_index_js.js.map +1 -0
  55. package/package.json +74 -7
  56. package/pyodide-worker.js +1207 -0
  57. package/pyodide-worker.js.map +1 -0
  58. package/vendor/cfn-guard/guard.js +414 -0
  59. package/vendor/cfn-guard/guard_bg.wasm +0 -0
  60. package/vendor/cfn-guard/index.js +87 -0
  61. package/vendor/cfn-guard/package.json +39 -0
  62. package/vendors-node_modules_aws-sdk_client-cloudcontrol_dist-es_index_js-node_modules_aws-sdk_client-4d5eee.js +140762 -0
  63. package/vendors-node_modules_aws-sdk_client-cloudcontrol_dist-es_index_js-node_modules_aws-sdk_client-4d5eee.js.map +1 -0
  64. package/vendors-node_modules_aws-sdk_credential-provider-sso_dist-es_loadSso_js.js +577 -0
  65. package/vendors-node_modules_aws-sdk_credential-provider-sso_dist-es_loadSso_js.js.map +1 -0
  66. package/vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_signin_index_js.js +697 -0
  67. package/vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_signin_index_js.js.map +1 -0
  68. package/vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_sso-oidc_index_js.js +769 -0
  69. package/vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_sso-oidc_index_js.js.map +1 -0
  70. package/vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_sts_index_js.js +990 -0
  71. package/vendors-node_modules_aws-sdk_nested-clients_dist-es_submodules_sts_index_js.js.map +1 -0
  72. package/vendors-node_modules_base2_pretty-print-object_dist_index_js-node_modules_vscode-jsonrpc_node-9a0a8d.js +8429 -0
  73. package/vendors-node_modules_base2_pretty-print-object_dist_index_js-node_modules_vscode-jsonrpc_node-9a0a8d.js.map +1 -0
  74. package/vendors-node_modules_bowser_src_bowser_js.js +3300 -0
  75. package/vendors-node_modules_bowser_src_bowser_js.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pyodide-worker.js","mappings":";;;;;;;;;;AAyBA,oD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AAC;QACvC,OAAO,SAAS,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;;;;;;;;ACzHY;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,oCAAoC;AACnD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC,eAAe,mBAAO,CAAC,uCAAqB;AAC5C,aAAa,mBAAO,CAAC,uCAAqB;AAC1C,aAAa,mBAAO,CAAC,iEAAe;AACpC;AACA;AACA;AACA,gCAAgC;;;;;;;;AC3BnB;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,oCAAoC;AACnD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,wBAAwB,GAAG,aAAa;AACxC,oBAAoB,mBAAO,CAAC,WAAW;AACvC,WAAW,mBAAO,CAAC,6DAAoB;AACvC,iBAAiB,mBAAO,CAAC,2DAAkB;AAC3C,WAAW,mBAAO,CAAC,wDAAS;AAC5B,eAAe,mBAAO,CAAC,uDAAqC;AAC5D,aAAa,mBAAO,CAAC,uDAAqC;AAC1D,aAAa,mBAAO,CAAC,wDAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,YAAY,aAAa,aAAa;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,yBAAyB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2IAA2I,OAAO;AAClJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,SAAS,EAAE,gBAAgB;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,QAAQ,IAAI,QAAQ;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,EAAE;AAC1D;AACA;AACA,4BAA4B,gBAAgB;AAC5C;AACA,sBAAsB,QAAQ,IAAI,MAAM;AACxC;AACA;AACA;AACA;AACA;;;;;;;;ACjRA,oC;;;;;;;ACAA,wD;;;;;;;ACAA,0C;;;;;;;ACAA,mC;;;;;;;ACAA,+B;;;;;;;ACAA,gC;;;;;;;ACAA,sC;;;;;;;ACAA,+B;;;;;;;ACAA,iC;;;;;;;ACAA,gC;;;;;;;ACAA,iC;;;;;;;ACAA,2C;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;;;;WClCA;WACA;WACA;WACA;WACA,+BAA+B,wCAAwC;WACvE;WACA;WACA;WACA;WACA,iBAAiB,qBAAqB;WACtC;WACA;WACA,kBAAkB,qBAAqB;WACvC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,E;;;;;WC3BA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,EAAE;WACF,E;;;;;WCRA;WACA;WACA;WACA;WACA,E;;;;;WCJA,wF;;;;;WCAA;;WAEA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,gBAAgB,qBAAqB;WACrC;WACA;WACA;;WAEA;WACA;WACA;WACA;WACA,aAAa;WACb;WACA;WACA;WACA;WACA,IAAI;WACJ;WACA;;WAEA;;WAEA;;WAEA,kB;;;;;WCxCA;WACA;WACA;WACA;WACA,E;;;;;UEJA;UACA","sources":["webpack://@aws/cloudformation-languageserver/./src/services/cfnLint/CfnLintDiagnosticConverter.ts","webpack://@aws/cloudformation-languageserver/./src/services/cfnLint/pyodide-worker.ts","webpack://@aws/cloudformation-languageserver/./src/utils/String.ts","webpack://@aws/cloudformation-languageserver/./src/utils/errors/ErrorUtils.ts","webpack://@aws/cloudformation-languageserver/./node_modules/vscode-languageserver-protocol/lib/node/main.js","webpack://@aws/cloudformation-languageserver/./node_modules/vscode-languageserver/lib/node/main.js","webpack://@aws/cloudformation-languageserver/external commonjs2 \"pyodide\"","webpack://@aws/cloudformation-languageserver/external commonjs2 \"vscode-languageserver-types\"","webpack://@aws/cloudformation-languageserver/external node-commonjs \"child_process\"","webpack://@aws/cloudformation-languageserver/external node-commonjs \"crypto\"","webpack://@aws/cloudformation-languageserver/external node-commonjs \"fs\"","webpack://@aws/cloudformation-languageserver/external node-commonjs \"net\"","webpack://@aws/cloudformation-languageserver/external node-commonjs \"node:util\"","webpack://@aws/cloudformation-languageserver/external node-commonjs \"os\"","webpack://@aws/cloudformation-languageserver/external node-commonjs \"path\"","webpack://@aws/cloudformation-languageserver/external node-commonjs \"url\"","webpack://@aws/cloudformation-languageserver/external node-commonjs \"util\"","webpack://@aws/cloudformation-languageserver/external node-commonjs \"worker_threads\"","webpack://@aws/cloudformation-languageserver/webpack/bootstrap","webpack://@aws/cloudformation-languageserver/webpack/runtime/chunk loaded","webpack://@aws/cloudformation-languageserver/webpack/runtime/ensure chunk","webpack://@aws/cloudformation-languageserver/webpack/runtime/get javascript chunk filename","webpack://@aws/cloudformation-languageserver/webpack/runtime/hasOwnProperty shorthand","webpack://@aws/cloudformation-languageserver/webpack/runtime/require chunk loading","webpack://@aws/cloudformation-languageserver/webpack/runtime/startup chunk dependencies","webpack://@aws/cloudformation-languageserver/webpack/before-startup","webpack://@aws/cloudformation-languageserver/webpack/startup","webpack://@aws/cloudformation-languageserver/webpack/after-startup"],"sourcesContent":["import { DiagnosticSeverity, PublishDiagnosticsParams } from 'vscode-languageserver';\n\n// JSON shape from cfn-lint --format json. Shared by local and Pyodide paths.\nexport type CfnLintDiagnostic = {\n Level: string;\n Message: string;\n Rule: {\n Id: string;\n Source: string;\n };\n Location: {\n Start: {\n LineNumber: number;\n ColumnNumber: number;\n };\n End: {\n LineNumber: number;\n ColumnNumber: number;\n };\n Path: unknown;\n };\n Filename: string;\n};\n\n// Returns [] (not [{uri, diagnostics: []}]) when no findings, so callers can skip publishing.\nexport function toPublishDiagnostics(diagnostics: CfnLintDiagnostic[], uri: string): PublishDiagnosticsParams[] {\n if (!diagnostics || diagnostics.length === 0) {\n return [];\n }\n\n const lspDiagnostics = diagnostics.map((item) => {\n const base = {\n severity: convertSeverity(item.Level),\n range: {\n start: {\n line: Math.max(0, (item.Location?.Start?.LineNumber || 1) - 1),\n character: Math.max(0, (item.Location?.Start?.ColumnNumber || 1) - 1),\n },\n end: {\n line: Math.max(0, (item.Location?.End?.LineNumber || 1) - 1),\n character: Math.max(0, (item.Location?.End?.ColumnNumber || 1) - 1),\n },\n },\n message: item.Message || 'Unknown cfn-lint error',\n source: 'cfn-lint',\n code: item.Rule?.Id || 'unknown',\n };\n\n const sourceUrl = item.Rule?.Source;\n if (sourceUrl) {\n return { ...base, codeDescription: { href: sourceUrl } };\n }\n return base;\n });\n\n return [{ uri, diagnostics: lspDiagnostics }];\n}\n\nfunction convertSeverity(level: string): DiagnosticSeverity {\n switch (level) {\n case 'Error': {\n return DiagnosticSeverity.Error;\n }\n case 'Warning': {\n return DiagnosticSeverity.Warning;\n }\n case 'Informational':\n case 'Info': {\n return DiagnosticSeverity.Information;\n }\n default: {\n return DiagnosticSeverity.Information;\n }\n }\n}\n","import path from 'path';\nimport { parentPort } from 'worker_threads';\nimport { loadPyodide, type PyodideInterface } from 'pyodide';\nimport { PublishDiagnosticsParams } from 'vscode-languageserver';\nimport { CloudFormationFileType } from '../../document/Document';\nimport { extractErrorMessage } from '../../utils/errors/ErrorUtils';\nimport { CfnLintDiagnostic, toPublishDiagnostics } from './CfnLintDiagnosticConverter';\n\n// Instead of sending stdout/stderr messages back to the main thread,\n// we'll just log them in the worker thread\nconst customStdout = (_text: string): void => {\n // No-op in production, used for debugging\n // console.log(text);\n};\n\nconst customStderr = (_text: string): void => {\n // No-op in production, used for debugging\n // console.error(text);\n};\n\ninterface WorkerMessage {\n id: string;\n action: string;\n payload: Record<string, unknown>;\n}\n\ninterface InitializeResult {\n status: 'initialized' | 'already-initialized' | 'already-initializing';\n installSource?: string;\n}\n\ninterface MountResult {\n mounted: boolean;\n mountDir: string;\n}\n\nlet pyodide: PyodideInterface | undefined;\nlet initialized = false;\nlet initializing = false;\n\n// Handle messages from main thread\nif (parentPort) {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n parentPort.on('message', async (message: WorkerMessage) => {\n const { id, action, payload } = message;\n\n try {\n let result: unknown;\n\n switch (action) {\n case 'initialize': {\n result = await initializePyodide();\n break;\n }\n case 'lint': {\n result = await lintTemplate(\n payload.content as string,\n payload.uri as string,\n payload.fileType as CloudFormationFileType,\n payload.settings as Record<string, unknown>,\n );\n break;\n }\n case 'lintFile': {\n result = await lintFile(\n payload.path as string,\n payload.uri as string,\n payload.fileType as CloudFormationFileType,\n payload.settings as Record<string, unknown>,\n );\n break;\n }\n case 'mountFolder': {\n result = mountFolder(payload.fsDir as string, payload.mountDir as string);\n break;\n }\n case 'getVersion': {\n result = await getVersion();\n break;\n }\n default: {\n throw new Error(`Unknown action: ${action}`);\n }\n }\n\n // Send successful result back to main thread\n if (parentPort !== null && parentPort !== undefined) {\n parentPort.postMessage({ id, result, success: true });\n }\n } catch (error) {\n // Send error back to main thread\n if (parentPort !== null && parentPort !== undefined) {\n parentPort.postMessage({\n id,\n error: extractErrorMessage(error),\n success: false,\n phase: action === 'initialize' ? currentInitPhase : undefined,\n });\n }\n }\n });\n}\n\ntype InitPhase =\n 'pyodide_load' | 'micropip_load' | 'ssl_load' | 'packages_load' | 'cfn_lint_install' | 'cfn_lint_setup';\n\nlet currentInitPhase: InitPhase = 'pyodide_load';\n\n// Initialize Pyodide with cfn-lint\nasync function initializePyodide(): Promise<InitializeResult> {\n if (initialized) {\n return { status: 'already-initialized' };\n }\n\n if (initializing) {\n return { status: 'already-initializing' };\n }\n\n initializing = true;\n\n try {\n // Load Pyodide with explicit stdout/stderr handlers\n currentInitPhase = 'pyodide_load';\n pyodide = await loadPyodide({\n stdout: customStdout,\n stderr: customStderr,\n });\n\n if (!pyodide) {\n throw new Error('Failed to initialize Pyodide: returned null');\n }\n\n // Mount assets directory early so local wheels are available as fallback\n const assetsPath = path.join(__dirname, 'assets');\n try {\n pyodide.FS.mkdirTree('/assets');\n pyodide.mountNodeFS('/assets', assetsPath);\n } catch {\n // Failed to mount assets directory\n }\n\n // Load bootstrap packages — micropip is required for fallback installs\n // loadPackage fetches from JsDelivr CDN which can silently fail\n // Set CFN_LSP_OFFLINE=1 to skip CDN and test local wheel fallback\n currentInitPhase = 'micropip_load';\n const offlineMode = process.env.CFN_LSP_OFFLINE === '1';\n if (!offlineMode) {\n await pyodide.loadPackage('micropip');\n }\n // ssl is a system shared library — must always use loadPackage (can't install via micropip)\n currentInitPhase = 'ssl_load';\n await pyodide.loadPackage('ssl');\n\n // Verify micropip is available; fall back to local wheel if CDN failed\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const micropipAvailable = await pyodide.runPythonAsync(`\n try:\n import micropip\n True\n except ModuleNotFoundError:\n False\n `);\n if (!micropipAvailable) {\n // loadPackage with emfs: URLs also silently fails, so unzip directly\n await pyodide.runPythonAsync(`\n from pathlib import Path\n from zipfile import ZipFile\n import importlib, site\n wheels = list(Path('/assets/wheels').glob('micropip-*.whl'))\n if not wheels:\n raise ModuleNotFoundError('micropip not available and no local wheel found')\n with ZipFile(str(wheels[0])) as zf:\n zf.extractall(site.getsitepackages()[0])\n importlib.invalidate_caches()\n import micropip\n `);\n }\n\n // Load packages with verification and local wheel/micropip fallback\n // Define the package mapping once, used for both verification and cfn-lint skip logic\n currentInitPhase = 'packages_load';\n const pyodidePackages = ['pyyaml', 'regex', 'rpds-py', 'pydantic', 'pydantic-core'];\n if (!offlineMode) {\n for (const pkg of pyodidePackages) {\n await pyodide.loadPackage(pkg);\n }\n }\n await pyodide.runPythonAsync(`\n import micropip\n from pathlib import Path\n\n # Package name -> import name mapping for Pyodide-managed packages\n PYODIDE_PACKAGES = {\n \"micropip\": \"micropip\", \"pyyaml\": \"yaml\", \"regex\": \"regex\",\n \"rpds-py\": \"rpds\", \"pydantic\": \"pydantic\", \"pydantic-core\": \"pydantic_core\", \"ssl\": \"ssl\",\n }\n\n _wheels_dir = Path('/assets/wheels')\n for pkg_name, import_name in PYODIDE_PACKAGES.items():\n try:\n __import__(import_name)\n except ModuleNotFoundError:\n _installed = False\n if _wheels_dir.exists():\n _prefix = pkg_name.replace('-', '_')\n _local = [w for w in _wheels_dir.glob('*.whl') if w.name.lower().startswith(_prefix.lower())]\n if _local:\n try:\n await micropip.install(f'emfs:{_local[0]}', deps=False)\n _installed = True\n except Exception:\n pass\n if not _installed:\n await micropip.install(pkg_name)\n `);\n\n // Replace CSafeLoader with SafeLoader to avoid Pyodide parsing issues\n await pyodide.runPythonAsync(`\n import yaml\n if hasattr(yaml, 'CSafeLoader'):\n yaml.CSafeLoader = yaml.SafeLoader\n `);\n\n // Install cfn-lint with local wheel fallback\n currentInitPhase = 'cfn_lint_install';\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const installResult = await pyodide.runPythonAsync(`\n import micropip\n from pathlib import Path\n \n cfn_lint_installed = False\n install_source = None\n \n # Try to install latest from PyPI first\n try:\n await micropip.install('cfn-lint')\n cfn_lint_installed = True\n install_source = 'pypi'\n except Exception:\n pass\n \n # Fallback to local wheels if online installation failed\n if not cfn_lint_installed:\n wheels_dir = Path('/assets/wheels')\n _fail_reason = f'wheels_dir exists={wheels_dir.exists()}'\n \n if wheels_dir.exists():\n wheel_files = list(wheels_dir.glob('*.whl'))\n _fail_reason = f'{len(wheel_files)} wheel files found'\n \n if wheel_files:\n try:\n # Skip packages already installed above\n _skip = {p.replace('-','_') for p in PYODIDE_PACKAGES}\n for whl in wheel_files:\n if whl.name.split('-')[0].lower() in _skip:\n continue\n await micropip.install(f'emfs:{whl}', deps=False)\n cfn_lint_installed = True\n install_source = 'wheels'\n except Exception as e:\n _fail_reason = f'wheel install error: {e}'\n \n if not cfn_lint_installed:\n raise Exception(f'Failed to install cfn-lint from both PyPI and local wheels. {_fail_reason}')\n \n install_source\n `);\n\n // Setup Python functions for linting\n currentInitPhase = 'cfn_lint_setup';\n await pyodide.runPythonAsync(`\n from cfnlint.version import __version__\n\n print('cfn-lint version:', __version__)\n \n from pathlib import Path\n from cfnlint import lint, lint_by_config, ManualArgs\n from cfnlint.formatters import JsonFormatter\n\n _json_formatter = JsonFormatter()\n\n def lint_to_json(matches):\n # Use JsonFormatter for --format json parity. Sort to match CLI ordering.\n sorted_matches = sorted(matches, key=lambda m: (m.filename, m.linenumber, m.rule.id))\n return _json_formatter.print_matches(sorted_matches, None, None)\n \n def parse_cfn_lint_settings(settings):\n \"\"\"Parse cfn-lint settings into ManualArgs format\"\"\"\n config = {}\n if not settings:\n return config\n \n if settings.get('ignoreChecks'):\n config['ignore_checks'] = settings['ignoreChecks']\n if settings.get('includeChecks'):\n config['include_checks'] = settings['includeChecks']\n if settings.get('mandatoryChecks'):\n config['mandatory_checks'] = settings['mandatoryChecks']\n if settings.get('includeExperimental'):\n config['include_experimental'] = settings['includeExperimental']\n if settings.get('configureRules'):\n # Parse configure rules from string format \"RuleId:key=value\"\n configure_rules = {}\n for rule_config in settings['configureRules']:\n if ':' in rule_config:\n rule_id, config_str = rule_config.split(':', 1)\n if '=' in config_str:\n key, value = config_str.split('=', 1)\n if rule_id not in configure_rules:\n configure_rules[rule_id] = {}\n # Convert string values to appropriate types\n if value.lower() == 'true':\n configure_rules[rule_id][key] = True\n elif value.lower() == 'false':\n configure_rules[rule_id][key] = False\n else:\n try:\n configure_rules[rule_id][key] = int(value)\n except ValueError:\n configure_rules[rule_id][key] = value\n if configure_rules:\n config['configure_rules'] = configure_rules\n if settings.get('regions'):\n config['regions'] = settings['regions']\n return config\n\n def lint_str(template_str, uri, settings=None):\n \"\"\"\n Lint a CloudFormation template string and return cfn-lint JSON findings.\n \n Args:\n template_str (str): CloudFormation template as a string\n uri (str): Document URI (unused here; passed through to the TS caller)\n settings (dict, optional): cfn-lint settings\n\n Returns:\n str: JSON array of cfn-lint findings (same schema as --format json)\n \"\"\"\n config = parse_cfn_lint_settings(settings)\n return lint_to_json(lint(template_str, config=ManualArgs(**config) if config else None))\n\n def lint_uri(lint_path, uri, lint_type, settings=None):\n import glob\n config = parse_cfn_lint_settings(settings)\n path = Path(lint_path)\n\n # cfn-lint expands these paths with glob.glob and raises ValueError when\n # nothing matches, so escape glob metacharacters (e.g. [, ], *, ?) to make\n # sure the path is treated literally.\n if lint_type == \"template\":\n config[\"templates\"] = [glob.escape(str(path))]\n elif lint_type == \"gitsync-deployment\":\n config[\"deployment_files\"] = [glob.escape(str(path))]\n\n return lint_to_json(lint_by_config(ManualArgs(**config)))\n `);\n\n // Create result object with installation source\n const result = { status: 'initialized' as const, installSource: installResult as string };\n\n // eslint-disable-next-line require-atomic-updates\n initialized = true;\n // eslint-disable-next-line require-atomic-updates\n initializing = false;\n\n return result;\n } catch (error) {\n // eslint-disable-next-line require-atomic-updates\n initializing = false;\n throw error;\n }\n}\n\nasync function getVersion(): Promise<string> {\n if (!pyodide) {\n throw new Error('Pyodide not initialized');\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const result = await pyodide.runPythonAsync(`\n from cfnlint.version import __version__\n __version__\n `);\n\n return result as string;\n}\n\n// Parse the JSON string returned by lint_str/lint_uri (cfn-lint JsonFormatter output)\n// and convert to LSP diagnostics using the shared converter.\nexport function convertPythonResultToDiagnostics(result: unknown, uri: string): PublishDiagnosticsParams[] {\n if (typeof result !== 'string') {\n throw new TypeError('Expected a JSON string from Python linting');\n }\n let findings: CfnLintDiagnostic[];\n try {\n findings = JSON.parse(result) as CfnLintDiagnostic[];\n } catch (error) {\n throw new Error(\n `Failed to parse cfn-lint output from Pyodide: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n return toPublishDiagnostics(findings, uri);\n}\n\n// Lint template content as string\nasync function lintTemplate(\n content: string,\n uri: string,\n _fileType: CloudFormationFileType,\n settings?: Record<string, unknown>,\n): Promise<PublishDiagnosticsParams[]> {\n if (!initialized || !pyodide) {\n throw new Error('Pyodide not initialized');\n }\n\n // Safe type assertions since we know the expected types\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const pyUri = pyodide.toPy(uri);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const pyContent = pyodide.toPy(content.replaceAll('\"\"\"', '\\\\\"\\\\\"\\\\\"'));\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const pySettings = pyodide.toPy(settings ?? {});\n\n // Execute Python code and get result\n const pythonCode = `lint_str(r\"\"\"${pyContent}\"\"\", r\"\"\"${pyUri}\"\"\", ${pySettings})`;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const result = await pyodide.runPythonAsync(pythonCode);\n\n return convertPythonResultToDiagnostics(result, uri);\n}\n\n// Lint file using path\nasync function lintFile(\n path: string,\n uri: string,\n fileType: CloudFormationFileType,\n settings?: Record<string, unknown>,\n): Promise<PublishDiagnosticsParams[]> {\n if (!initialized || !pyodide) {\n throw new Error('Pyodide not initialized');\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const pySettings = pyodide.toPy(settings ?? {});\n\n // Execute Python code and get result\n const pythonCode = `lint_uri(r\"\"\"${path}\"\"\", r\"\"\"${uri}\"\"\", r\"\"\"${fileType}\"\"\", ${pySettings})`;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const result = await pyodide.runPythonAsync(pythonCode);\n\n return convertPythonResultToDiagnostics(result, uri);\n}\n\n// Mount folder to Pyodide filesystem\nfunction mountFolder(fsDir: string, mountDir: string): MountResult {\n if (!initialized || !pyodide) {\n throw new Error('Pyodide not initialized');\n }\n\n try {\n pyodide.FS.mkdirTree(mountDir);\n\n // The first parameter should be the mount point, the second parameter should be the host path\n pyodide.mountNodeFS(mountDir, fsDir);\n\n return { mounted: true, mountDir };\n } catch (error) {\n // Clean up if mounting fails\n try {\n pyodide.FS.rmdir(mountDir);\n } catch {\n // Ignore cleanup errors\n }\n throw error;\n }\n}\n","import { prettyPrint } from '@base2/pretty-print-object';\n\nexport function toString(value: unknown, indent = '\\t'.repeat(1)) {\n if (value === null || !['object', 'function'].includes(typeof value)) {\n return String(value);\n }\n\n return prettyPrint(value, {\n indent,\n inlineCharacterLimit: 50,\n });\n}\n\nexport function dashesToUnderscores(input: string): string {\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n return input.replace(/-/g, '_');\n}\n\nexport function removeQuotes(str: string): string {\n // Only replace starting and ending quotes\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n return str.replace(/^['\"]|['\"]$/g, '');\n}\n\nexport function isStringABoolean(value: string): boolean {\n return ['true', 'false'].includes(value.trim().toLowerCase());\n}\n\nexport function stringToBoolean(value: string): boolean {\n return value.trim().toLowerCase() === 'true';\n}\n\nexport function byteSize(str: string) {\n const bytes: Uint8Array = new TextEncoder().encode(str);\n return bytes.length;\n}\n\nexport function formatNumber(value: number, decimals: number = 2) {\n return value.toFixed(decimals);\n}\n\nexport function toStringOrUndefined(value: unknown): string | undefined {\n if (typeof value === 'string') return value;\n if (typeof value === 'number' || typeof value === 'boolean') return String(value);\n return undefined;\n}\n","import { ErrorCodes, ResponseError } from 'vscode-languageserver';\nimport { toString } from '../String';\n\nexport function extractStatusReason(error: unknown): string | undefined {\n try {\n const message = error instanceof Error ? error.message : String(error);\n const parsed = JSON.parse(message) as { reason?: { StatusReason?: string } };\n if (parsed?.reason?.StatusReason) {\n return parsed.reason.StatusReason;\n }\n } catch {\n // Not JSON, continue with normal error handling\n }\n}\n\nexport function extractErrorMessage(error: unknown) {\n if (error instanceof Error) {\n const prefix = error.name === 'Error' ? '' : `${error.name}: `;\n return `${prefix}${error.message}`;\n }\n\n return toString(error);\n}\n\nfunction createResponseError(code: number, message: string, cause: unknown): ResponseError<unknown> {\n const responseError = new ResponseError<unknown>(code, message);\n responseError.cause = cause;\n return responseError;\n}\n\nexport function handleLspError(error: unknown, contextMessage: string): never {\n if (error instanceof ResponseError) {\n throw error;\n }\n if (error instanceof TypeError) {\n throw createResponseError(ErrorCodes.InvalidParams, error.message, error);\n }\n throw createResponseError(ErrorCodes.InternalError, `${contextMessage}: ${extractErrorMessage(error)}`, error);\n}\n\nexport function extractRootCause(error: unknown): Error | undefined {\n const [, cause] = errorCauseChain(error);\n return cause instanceof Error ? cause : undefined;\n}\n\nconst MaxCauseDepth = 8;\n\nexport function errorCauseChain(error: unknown): unknown[] {\n const chain: unknown[] = [];\n const seen = new Set<unknown>();\n let current: unknown = error;\n\n while (current !== undefined && current !== null && chain.length < MaxCauseDepth) {\n if (typeof current === 'object') {\n if (seen.has(current)) {\n break;\n }\n seen.add(current);\n }\n\n chain.push(current);\n\n if (typeof current !== 'object') {\n break;\n }\n\n const { cause, commitError } = current as { cause?: unknown; commitError?: unknown };\n // A promise-valued `commitError` carries no synchronously readable message; only a resolved\n // one (see `attachCommitCause`) is useful here.\n current = (commitError instanceof Error ? commitError : undefined) ?? cause;\n }\n\n return chain;\n}\n\nexport function extractErrorCode(error: unknown): string | undefined {\n if (error === null || typeof error !== 'object') {\n return undefined;\n }\n\n const { code, Code, CODE, errno } = error as { code?: unknown; Code?: unknown; CODE?: unknown; errno?: number };\n\n for (const val of [code, Code, CODE]) {\n if (typeof val === 'string') {\n return val;\n }\n }\n\n for (const val of [code, errno]) {\n if (typeof val === 'number') {\n return `${val}`;\n }\n }\n\n return undefined;\n}\n\nexport function extractHttpStatus(error: unknown): number | undefined {\n if (error === null || typeof error !== 'object') {\n return undefined;\n }\n\n const candidate = error as {\n $metadata?: { httpStatusCode?: number };\n response?: { status?: number };\n status?: number;\n };\n\n if (typeof candidate.$metadata?.httpStatusCode === 'number') {\n return candidate.$metadata?.httpStatusCode;\n }\n\n if (typeof candidate.response?.status === 'number') {\n return candidate.response?.status;\n }\n\n if (typeof candidate.status === 'number') {\n return candidate.status;\n }\n\n return undefined;\n}\n","\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createProtocolConnection = void 0;\nconst node_1 = require(\"vscode-jsonrpc/node\");\n__exportStar(require(\"vscode-jsonrpc/node\"), exports);\n__exportStar(require(\"../common/api\"), exports);\nfunction createProtocolConnection(input, output, logger, options) {\n return (0, node_1.createMessageConnection)(input, output, logger, options);\n}\nexports.createProtocolConnection = createProtocolConnection;\n","\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n/// <reference path=\"../../typings/thenable.d.ts\" />\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createConnection = exports.Files = void 0;\nconst node_util_1 = require(\"node:util\");\nconst Is = require(\"../common/utils/is\");\nconst server_1 = require(\"../common/server\");\nconst fm = require(\"./files\");\nconst node_1 = require(\"vscode-languageserver-protocol/node\");\n__exportStar(require(\"vscode-languageserver-protocol/node\"), exports);\n__exportStar(require(\"../common/api\"), exports);\nvar Files;\n(function (Files) {\n Files.uriToFilePath = fm.uriToFilePath;\n Files.resolveGlobalNodePath = fm.resolveGlobalNodePath;\n Files.resolveGlobalYarnPath = fm.resolveGlobalYarnPath;\n Files.resolve = fm.resolve;\n Files.resolveModulePath = fm.resolveModulePath;\n})(Files || (exports.Files = Files = {}));\nlet _protocolConnection;\nfunction endProtocolConnection() {\n if (_protocolConnection === undefined) {\n return;\n }\n try {\n _protocolConnection.end();\n }\n catch (_err) {\n // Ignore. The client process could have already\n // did and we can't send an end into the connection.\n }\n}\nlet _shutdownReceived = false;\nlet exitTimer = undefined;\nfunction setupExitTimer() {\n const argName = '--clientProcessId';\n function runTimer(value) {\n try {\n let processId = parseInt(value);\n if (!isNaN(processId)) {\n exitTimer = setInterval(() => {\n try {\n process.kill(processId, 0);\n }\n catch (ex) {\n // Parent process doesn't exist anymore. Exit the server.\n endProtocolConnection();\n process.exit(_shutdownReceived ? 0 : 1);\n }\n }, 3000);\n }\n }\n catch (e) {\n // Ignore errors;\n }\n }\n for (let i = 2; i < process.argv.length; i++) {\n let arg = process.argv[i];\n if (arg === argName && i + 1 < process.argv.length) {\n runTimer(process.argv[i + 1]);\n return;\n }\n else {\n let args = arg.split('=');\n if (args[0] === argName) {\n runTimer(args[1]);\n }\n }\n }\n}\nsetupExitTimer();\nconst watchDog = {\n initialize: (params) => {\n const processId = params.processId;\n if (Is.number(processId) && exitTimer === undefined) {\n // We received a parent process id. Set up a timer to periodically check\n // if the parent is still alive.\n setInterval(() => {\n try {\n process.kill(processId, 0);\n }\n catch (ex) {\n // Parent process doesn't exist anymore. Exit the server.\n process.exit(_shutdownReceived ? 0 : 1);\n }\n }, 3000);\n }\n },\n get shutdownReceived() {\n return _shutdownReceived;\n },\n set shutdownReceived(value) {\n _shutdownReceived = value;\n },\n exit: (code) => {\n endProtocolConnection();\n process.exit(code);\n }\n};\nfunction createConnection(arg1, arg2, arg3, arg4) {\n let factories;\n let input;\n let output;\n let options;\n if (arg1 !== void 0 && arg1.__brand === 'features') {\n factories = arg1;\n arg1 = arg2;\n arg2 = arg3;\n arg3 = arg4;\n }\n if (node_1.ConnectionStrategy.is(arg1) || node_1.ConnectionOptions.is(arg1)) {\n options = arg1;\n }\n else {\n input = arg1;\n output = arg2;\n options = arg3;\n }\n return _createConnection(input, output, options, factories);\n}\nexports.createConnection = createConnection;\nfunction _createConnection(input, output, options, factories) {\n let stdio = false;\n if (!input && !output && process.argv.length > 2) {\n let port = void 0;\n let pipeName = void 0;\n let argv = process.argv.slice(2);\n for (let i = 0; i < argv.length; i++) {\n let arg = argv[i];\n if (arg === '--node-ipc') {\n input = new node_1.IPCMessageReader(process);\n output = new node_1.IPCMessageWriter(process);\n break;\n }\n else if (arg === '--stdio') {\n stdio = true;\n input = process.stdin;\n output = process.stdout;\n break;\n }\n else if (arg === '--socket') {\n port = parseInt(argv[i + 1]);\n break;\n }\n else if (arg === '--pipe') {\n pipeName = argv[i + 1];\n break;\n }\n else {\n var args = arg.split('=');\n if (args[0] === '--socket') {\n port = parseInt(args[1]);\n break;\n }\n else if (args[0] === '--pipe') {\n pipeName = args[1];\n break;\n }\n }\n }\n if (port) {\n let transport = (0, node_1.createServerSocketTransport)(port);\n input = transport[0];\n output = transport[1];\n }\n else if (pipeName) {\n let transport = (0, node_1.createServerPipeTransport)(pipeName);\n input = transport[0];\n output = transport[1];\n }\n }\n var commandLineMessage = 'Use arguments of createConnection or set command line parameters: \\'--node-ipc\\', \\'--stdio\\' or \\'--socket={number}\\'';\n if (!input) {\n throw new Error('Connection input stream is not set. ' + commandLineMessage);\n }\n if (!output) {\n throw new Error('Connection output stream is not set. ' + commandLineMessage);\n }\n // Backwards compatibility\n if (Is.func(input.read) && Is.func(input.on)) {\n let inputStream = input;\n inputStream.on('end', () => {\n endProtocolConnection();\n process.exit(_shutdownReceived ? 0 : 1);\n });\n inputStream.on('close', () => {\n endProtocolConnection();\n process.exit(_shutdownReceived ? 0 : 1);\n });\n }\n const connectionFactory = (logger) => {\n const result = (0, node_1.createProtocolConnection)(input, output, logger, options);\n if (stdio) {\n patchConsole(logger);\n }\n return result;\n };\n return (0, server_1.createConnection)(connectionFactory, watchDog, factories);\n}\nfunction patchConsole(logger) {\n function serialize(args) {\n return args.map(arg => typeof arg === 'string' ? arg : (0, node_util_1.inspect)(arg)).join(' ');\n }\n const counters = new Map();\n console.assert = function assert(assertion, ...args) {\n if (assertion) {\n return;\n }\n if (args.length === 0) {\n logger.error('Assertion failed');\n }\n else {\n const [message, ...rest] = args;\n logger.error(`Assertion failed: ${message} ${serialize(rest)}`);\n }\n };\n console.count = function count(label = 'default') {\n const message = String(label);\n let counter = counters.get(message) ?? 0;\n counter += 1;\n counters.set(message, counter);\n logger.log(`${message}: ${message}`);\n };\n console.countReset = function countReset(label) {\n if (label === undefined) {\n counters.clear();\n }\n else {\n counters.delete(String(label));\n }\n };\n console.debug = function debug(...args) {\n logger.log(serialize(args));\n };\n console.dir = function dir(arg, options) {\n // @ts-expect-error https://github.com/DefinitelyTyped/DefinitelyTyped/pull/66626\n logger.log((0, node_util_1.inspect)(arg, options));\n };\n console.log = function log(...args) {\n logger.log(serialize(args));\n };\n console.error = function error(...args) {\n logger.error(serialize(args));\n };\n console.trace = function trace(...args) {\n const stack = new Error().stack.replace(/(.+\\n){2}/, '');\n let message = 'Trace';\n if (args.length !== 0) {\n message += `: ${serialize(args)}`;\n }\n logger.log(`${message}\\n${stack}`);\n };\n console.warn = function warn(...args) {\n logger.warn(serialize(args));\n };\n}\n","module.exports = require(\"pyodide\");","module.exports = require(\"vscode-languageserver-types\");","module.exports = require(\"child_process\");","module.exports = require(\"crypto\");","module.exports = require(\"fs\");","module.exports = require(\"net\");","module.exports = require(\"node:util\");","module.exports = require(\"os\");","module.exports = require(\"path\");","module.exports = require(\"url\");","module.exports = require(\"util\");","module.exports = require(\"worker_threads\");","// The module cache\nconst __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tconst cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tconst module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n// the startup function\n__webpack_require__.x = () => {\n\t// Load entry module and return exports\n\t// This entry module depends on other loaded chunks and execution need to be delayed\n\tlet __webpack_exports__ = __webpack_require__.O(undefined, [\"vendors-node_modules_base2_pretty-print-object_dist_index_js-node_modules_vscode-jsonrpc_node-9a0a8d\"], () => (__webpack_require__(\"./src/services/cfnLint/pyodide-worker.ts\")))\n\t__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n\treturn __webpack_exports__;\n};\n\n","const deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tlet notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tlet [chunkIds, fn, priority] = deferred[i];\n\t\tlet fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tconst r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks and chunks that the entrypoint depends on\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \".js\";\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// no baseURI\n\n// object to store loaded chunks\n// \"1\" means \"loaded\", otherwise not loaded yet\nconst installedChunks = {\n\t\"pyodide-worker\": 1\n};\n\n__webpack_require__.O.require = (chunkId) => (installedChunks[chunkId]);\n\nconst installChunk = (chunk) => {\n\tconst moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;\n\tfor(var moduleId in moreModules) {\n\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t}\n\t}\n\tif(runtime) runtime(__webpack_require__);\n\tfor(var i = 0; i < chunkIds.length; i++)\n\t\tinstalledChunks[chunkIds[i]] = 1;\n\t__webpack_require__.O();\n};\n\n// require() chunk loading for javascript\n__webpack_require__.f.require = (chunkId, promises) => {\n\t// \"1\" is the signal for \"already loaded\"\n\tif(!installedChunks[chunkId]) {\n\t\tif(true) { // all chunks have JS\n\t\t\tconst installedChunk = require(\"./\" + __webpack_require__.u(chunkId));\n\t\t\tif (!installedChunks[chunkId]) {\n\t\t\t\tinstallChunk(installedChunk);\n\t\t\t}\n\t\t} else installedChunks[chunkId] = 1;\n\t}\n};\n\n// no external install chunk\n\n// no HMR\n\n// no HMR manifest","const next = __webpack_require__.x;\n__webpack_require__.x = () => {\n\t__webpack_require__.e(\"vendors-node_modules_base2_pretty-print-object_dist_index_js-node_modules_vscode-jsonrpc_node-9a0a8d\");\n\treturn next();\n};","","// run startup\nvar __webpack_exports__ = __webpack_require__.x();\n",""],"names":[],"sourceRoot":""}
@@ -0,0 +1,414 @@
1
+ let imports = {};
2
+ imports['__wbindgen_placeholder__'] = module.exports;
3
+ let wasm;
4
+ const { existsSync } = require(`fs`);
5
+ const { resolve } = require(`path`);
6
+ const { TextDecoder, TextEncoder } = require(`util`);
7
+
8
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
9
+
10
+ cachedTextDecoder.decode();
11
+
12
+ let cachedUint8Memory0 = null;
13
+
14
+ function getUint8Memory0() {
15
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
16
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
17
+ }
18
+ return cachedUint8Memory0;
19
+ }
20
+
21
+ function getStringFromWasm0(ptr, len) {
22
+ ptr = ptr >>> 0;
23
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
24
+ }
25
+
26
+ const heap = new Array(128).fill(undefined);
27
+
28
+ heap.push(undefined, null, true, false);
29
+
30
+ let heap_next = heap.length;
31
+
32
+ function addHeapObject(obj) {
33
+ if (heap_next === heap.length) heap.push(heap.length + 1);
34
+ const idx = heap_next;
35
+ heap_next = heap[idx];
36
+
37
+ heap[idx] = obj;
38
+ return idx;
39
+ }
40
+
41
+ function getObject(idx) { return heap[idx]; }
42
+
43
+ function isLikeNone(x) {
44
+ return x === undefined || x === null;
45
+ }
46
+
47
+ let cachedFloat64Memory0 = null;
48
+
49
+ function getFloat64Memory0() {
50
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
51
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
52
+ }
53
+ return cachedFloat64Memory0;
54
+ }
55
+
56
+ let cachedInt32Memory0 = null;
57
+
58
+ function getInt32Memory0() {
59
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
60
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
61
+ }
62
+ return cachedInt32Memory0;
63
+ }
64
+
65
+ function dropObject(idx) {
66
+ if (idx < 132) return;
67
+ heap[idx] = heap_next;
68
+ heap_next = idx;
69
+ }
70
+
71
+ function takeObject(idx) {
72
+ const ret = getObject(idx);
73
+ dropObject(idx);
74
+ return ret;
75
+ }
76
+
77
+ let WASM_VECTOR_LEN = 0;
78
+
79
+ let cachedTextEncoder = new TextEncoder('utf-8');
80
+
81
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
82
+ ? function (arg, view) {
83
+ return cachedTextEncoder.encodeInto(arg, view);
84
+ }
85
+ : function (arg, view) {
86
+ const buf = cachedTextEncoder.encode(arg);
87
+ view.set(buf);
88
+ return {
89
+ read: arg.length,
90
+ written: buf.length
91
+ };
92
+ });
93
+
94
+ function passStringToWasm0(arg, malloc, realloc) {
95
+
96
+ if (realloc === undefined) {
97
+ const buf = cachedTextEncoder.encode(arg);
98
+ const ptr = malloc(buf.length, 1) >>> 0;
99
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
100
+ WASM_VECTOR_LEN = buf.length;
101
+ return ptr;
102
+ }
103
+
104
+ let len = arg.length;
105
+ let ptr = malloc(len, 1) >>> 0;
106
+
107
+ const mem = getUint8Memory0();
108
+
109
+ let offset = 0;
110
+
111
+ for (; offset < len; offset++) {
112
+ const code = arg.charCodeAt(offset);
113
+ if (code > 0x7F) break;
114
+ mem[ptr + offset] = code;
115
+ }
116
+
117
+ if (offset !== len) {
118
+ if (offset !== 0) {
119
+ arg = arg.slice(offset);
120
+ }
121
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
122
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
123
+ const ret = encodeString(arg, view);
124
+
125
+ offset += ret.written;
126
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
127
+ }
128
+
129
+ WASM_VECTOR_LEN = offset;
130
+ return ptr;
131
+ }
132
+
133
+ let cachedUint32Memory0 = null;
134
+
135
+ function getUint32Memory0() {
136
+ if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
137
+ cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
138
+ }
139
+ return cachedUint32Memory0;
140
+ }
141
+
142
+ function passArrayJsValueToWasm0(array, malloc) {
143
+ const ptr = malloc(array.length * 4, 4) >>> 0;
144
+ const mem = getUint32Memory0();
145
+ for (let i = 0; i < array.length; i++) {
146
+ mem[ptr / 4 + i] = addHeapObject(array[i]);
147
+ }
148
+ WASM_VECTOR_LEN = array.length;
149
+ return ptr;
150
+ }
151
+
152
+ function handleError(f, args) {
153
+ try {
154
+ return f.apply(this, args);
155
+ } catch (e) {
156
+ wasm.__wbindgen_exn_store(addHeapObject(e));
157
+ }
158
+ }
159
+ /**
160
+ */
161
+ module.exports.OutputFormatType = Object.freeze({ SingleLineSummary:0,"0":"SingleLineSummary",JSON:1,"1":"JSON",YAML:2,"2":"YAML",Junit:3,"3":"Junit",Sarif:4,"4":"Sarif", });
162
+ /**
163
+ */
164
+ module.exports.ShowSummaryType = Object.freeze({ All:0,"0":"All",Pass:1,"1":"Pass",Fail:2,"2":"Fail",Skip:3,"3":"Skip",None:4,"4":"None", });
165
+
166
+ const ValidateBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
167
+ ? { register: () => {}, unregister: () => {} }
168
+ : new FinalizationRegistry(ptr => wasm.__wbg_validatebuilder_free(ptr >>> 0));
169
+ /**
170
+ * .
171
+ * A builder to help construct the `Validate` command
172
+ */
173
+ class ValidateBuilder {
174
+
175
+ static __wrap(ptr) {
176
+ ptr = ptr >>> 0;
177
+ const obj = Object.create(ValidateBuilder.prototype);
178
+ obj.__wbg_ptr = ptr;
179
+ ValidateBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
180
+ return obj;
181
+ }
182
+
183
+ __destroy_into_raw() {
184
+ const ptr = this.__wbg_ptr;
185
+ this.__wbg_ptr = 0;
186
+ ValidateBuilderFinalization.unregister(this);
187
+ return ptr;
188
+ }
189
+
190
+ free() {
191
+ const ptr = this.__destroy_into_raw();
192
+ wasm.__wbg_validatebuilder_free(ptr);
193
+ }
194
+ /**
195
+ * a list of paths that point to rule files, or a directory containing rule files on a local machine. Only files that end with .guard or .ruleset will be evaluated
196
+ * conflicts with payload
197
+ * @param {(string)[]} rules
198
+ * @returns {ValidateBuilder}
199
+ */
200
+ rules(rules) {
201
+ const ptr = this.__destroy_into_raw();
202
+ const ptr0 = passArrayJsValueToWasm0(rules, wasm.__wbindgen_malloc);
203
+ const len0 = WASM_VECTOR_LEN;
204
+ const ret = wasm.validatebuilder_rules(ptr, ptr0, len0);
205
+ return ValidateBuilder.__wrap(ret);
206
+ }
207
+ /**
208
+ * a list of paths that point to data files, or a directory containing data files for the rules to be evaluated against. Only JSON, or YAML files will be used
209
+ * conflicts with payload
210
+ * @param {(string)[]} data
211
+ * @returns {ValidateBuilder}
212
+ */
213
+ data(data) {
214
+ const ptr = this.__destroy_into_raw();
215
+ const ptr0 = passArrayJsValueToWasm0(data, wasm.__wbindgen_malloc);
216
+ const len0 = WASM_VECTOR_LEN;
217
+ const ret = wasm.validatebuilder_data(ptr, ptr0, len0);
218
+ return ValidateBuilder.__wrap(ret);
219
+ }
220
+ /**
221
+ * Controls if the summary table needs to be displayed. --show-summary fail (default) or --show-summary pass,fail (only show rules that did pass/fail) or --show-summary none (to turn it off) or --show-summary all (to show all the rules that pass, fail or skip)
222
+ * default is failed
223
+ * must be set to none if used together with the structured flag
224
+ * @param {any[]} args
225
+ * @returns {ValidateBuilder}
226
+ */
227
+ showSummary(args) {
228
+ const ptr = this.__destroy_into_raw();
229
+ const ptr0 = passArrayJsValueToWasm0(args, wasm.__wbindgen_malloc);
230
+ const len0 = WASM_VECTOR_LEN;
231
+ const ret = wasm.validatebuilder_showSummary(ptr, ptr0, len0);
232
+ return ValidateBuilder.__wrap(ret);
233
+ }
234
+ /**
235
+ * a list of paths that point to data files, or a directory containing data files to be merged with the data argument and then the rules will be evaluated against them. Only JSON, or YAML files will be used
236
+ * @param {(string)[]} input_params
237
+ * @returns {ValidateBuilder}
238
+ */
239
+ input_params(input_params) {
240
+ const ptr = this.__destroy_into_raw();
241
+ const ptr0 = passArrayJsValueToWasm0(input_params, wasm.__wbindgen_malloc);
242
+ const len0 = WASM_VECTOR_LEN;
243
+ const ret = wasm.validatebuilder_input_params(ptr, ptr0, len0);
244
+ return ValidateBuilder.__wrap(ret);
245
+ }
246
+ /**
247
+ * Specify the format in which the output should be displayed
248
+ * default is single-line-summary
249
+ * if junit is used, `structured` attributed must be set to true
250
+ * @param {OutputFormatType} output
251
+ * @returns {ValidateBuilder}
252
+ */
253
+ outputFormat(output) {
254
+ const ptr = this.__destroy_into_raw();
255
+ const ret = wasm.validatebuilder_outputFormat(ptr, output);
256
+ return ValidateBuilder.__wrap(ret);
257
+ }
258
+ /**
259
+ * Tells the command that rules, and data will be passed via a reader, as a json payload.
260
+ * Conflicts with both rules, and data
261
+ * default is false
262
+ * @param {boolean} arg
263
+ * @returns {ValidateBuilder}
264
+ */
265
+ payload(arg) {
266
+ const ptr = this.__destroy_into_raw();
267
+ const ret = wasm.validatebuilder_payload(ptr, arg);
268
+ return ValidateBuilder.__wrap(ret);
269
+ }
270
+ /**
271
+ * Validate files in a directory ordered alphabetically, conflicts with `last_modified` field
272
+ * @param {boolean} arg
273
+ * @returns {ValidateBuilder}
274
+ */
275
+ alphabetical(arg) {
276
+ const ptr = this.__destroy_into_raw();
277
+ const ret = wasm.validatebuilder_alphabetical(ptr, arg);
278
+ return ValidateBuilder.__wrap(ret);
279
+ }
280
+ /**
281
+ * Validate files in a directory ordered by last modified times, conflicts with `alphabetical` field
282
+ * @param {boolean} arg
283
+ * @returns {ValidateBuilder}
284
+ */
285
+ last_modified(arg) {
286
+ const ptr = this.__destroy_into_raw();
287
+ const ret = wasm.validatebuilder_last_modified(ptr, arg);
288
+ return ValidateBuilder.__wrap(ret);
289
+ }
290
+ /**
291
+ * Output verbose logging, conflicts with `structured` field
292
+ * default is false
293
+ * @param {boolean} arg
294
+ * @returns {ValidateBuilder}
295
+ */
296
+ verbose(arg) {
297
+ const ptr = this.__destroy_into_raw();
298
+ const ret = wasm.validatebuilder_verbose(ptr, arg);
299
+ return ValidateBuilder.__wrap(ret);
300
+ }
301
+ /**
302
+ * Print the parse tree in a json format. This can be used to get more details on how the clauses were evaluated
303
+ * conflicts with the `structured` attribute
304
+ * default is false
305
+ * @param {boolean} arg
306
+ * @returns {ValidateBuilder}
307
+ */
308
+ print_json(arg) {
309
+ const ptr = this.__destroy_into_raw();
310
+ const ret = wasm.validatebuilder_print_json(ptr, arg);
311
+ return ValidateBuilder.__wrap(ret);
312
+ }
313
+ /**
314
+ * Prints the output which must be specified to JSON/YAML/JUnit in a structured format
315
+ * Conflicts with the following attributes `verbose`, `print-json`, `output-format` when set
316
+ * to "single-line-summary", show-summary when set to anything other than "none"
317
+ * default is false
318
+ * @param {boolean} arg
319
+ * @returns {ValidateBuilder}
320
+ */
321
+ structured(arg) {
322
+ const ptr = this.__destroy_into_raw();
323
+ const ret = wasm.validatebuilder_structured(ptr, arg);
324
+ return ValidateBuilder.__wrap(ret);
325
+ }
326
+ /**
327
+ */
328
+ constructor() {
329
+ const ret = wasm.validatebuilder_new();
330
+ this.__wbg_ptr = ret >>> 0;
331
+ return this;
332
+ }
333
+ /**
334
+ * @param {string} payload
335
+ * @returns {any}
336
+ */
337
+ tryBuildAndExecute(payload) {
338
+ try {
339
+ const ptr = this.__destroy_into_raw();
340
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
341
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
342
+ const len0 = WASM_VECTOR_LEN;
343
+ wasm.validatebuilder_tryBuildAndExecute(retptr, ptr, ptr0, len0);
344
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
345
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
346
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
347
+ if (r2) {
348
+ throw takeObject(r1);
349
+ }
350
+ return takeObject(r0);
351
+ } finally {
352
+ wasm.__wbindgen_add_to_stack_pointer(16);
353
+ }
354
+ }
355
+ }
356
+ module.exports.ValidateBuilder = ValidateBuilder;
357
+
358
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
359
+ const ret = getStringFromWasm0(arg0, arg1);
360
+ return addHeapObject(ret);
361
+ };
362
+
363
+ module.exports.__wbindgen_try_into_number = function(arg0) {
364
+ let result;
365
+ try { result = +getObject(arg0) } catch (e) { result = e }
366
+ const ret = result;
367
+ return addHeapObject(ret);
368
+ };
369
+
370
+ module.exports.__wbindgen_number_get = function(arg0, arg1) {
371
+ const obj = getObject(arg1);
372
+ const ret = typeof(obj) === 'number' ? obj : undefined;
373
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
374
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
375
+ };
376
+
377
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
378
+ takeObject(arg0);
379
+ };
380
+
381
+ module.exports.__wbg_existsSync_2b54de1ac768abd3 = function() { return handleError(function (arg0, arg1) {
382
+ const ret = existsSync(getStringFromWasm0(arg0, arg1));
383
+ return ret;
384
+ }, arguments) };
385
+
386
+ module.exports.__wbg_resolve_88cfd218e55df477 = function() { return handleError(function (arg0, arg1, arg2) {
387
+ const ret = resolve(getStringFromWasm0(arg1, arg2));
388
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
389
+ const len1 = WASM_VECTOR_LEN;
390
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
391
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
392
+ }, arguments) };
393
+
394
+ module.exports.__wbindgen_string_get = function(arg0, arg1) {
395
+ const obj = getObject(arg1);
396
+ const ret = typeof(obj) === 'string' ? obj : undefined;
397
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
398
+ var len1 = WASM_VECTOR_LEN;
399
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
400
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
401
+ };
402
+
403
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
404
+ throw new Error(getStringFromWasm0(arg0, arg1));
405
+ };
406
+
407
+ const path = require('path').join(__dirname, 'guard_bg.wasm');
408
+ const bytes = require('fs').readFileSync(path);
409
+
410
+ const wasmModule = new WebAssembly.Module(bytes);
411
+ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
412
+ wasm = wasmInstance.exports;
413
+ module.exports.__wasm = wasm;
414
+
Binary file
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validate = void 0;
4
+ const guard_1 = require("./guard");
5
+ const path = require("node:path");
6
+ const fs = require("fs");
7
+ const DATA_FILE_SUPPORTED_EXTENSIONS = ['.yaml', '.yml', '.json', '.jsn', '.template'];
8
+ const RULE_FILE_SUPPORTED_EXTENSIONS = ['.guard', '.ruleset'];
9
+ const formatOutput = ({ result, rulesNames, dataNames }) => {
10
+ const dataPattern = /DATA_STDIN\[(\d+)\]/g;
11
+ const rulesPattern = /RULES_STDIN\[(\d+)\]\/DEFAULT/g;
12
+ const isWindows = process.platform === 'win32';
13
+ const output = JSON.parse(JSON.stringify(result).replace(dataPattern, (match, index) => {
14
+ const fileIndex = parseInt(index, 10) - 1;
15
+ const fileName = dataNames[fileIndex];
16
+ return fileName ? (isWindows ? fileName.split('\\').join('/') : fileName) : match;
17
+ }).replace(rulesPattern, (match, index) => {
18
+ const ruleIndex = parseInt(index, 10) - 1;
19
+ const ruleName = rulesNames[ruleIndex];
20
+ if (ruleName) {
21
+ const fileNameWithoutExtension = path.basename(ruleName, path.extname(ruleName));
22
+ return fileNameWithoutExtension.toUpperCase();
23
+ }
24
+ return match;
25
+ }));
26
+ return JSON.parse(output);
27
+ };
28
+ async function readFiles(dirOrFile, supportedExtensions) {
29
+ const fileNames = [];
30
+ const fileContents = [];
31
+ const stat = await fs.promises.stat(dirOrFile);
32
+ if (stat.isDirectory()) {
33
+ const files = await getAllFiles(dirOrFile, supportedExtensions);
34
+ const readPromises = files.map(async (file) => {
35
+ const content = await fs.promises.readFile(file, 'utf8');
36
+ fileNames.push(file);
37
+ fileContents.push(content);
38
+ });
39
+ await Promise.all(readPromises);
40
+ }
41
+ else if (stat.isFile() && supportedExtensions.includes(path.extname(dirOrFile))) {
42
+ const content = await fs.promises.readFile(dirOrFile, 'utf8');
43
+ fileNames.push(dirOrFile);
44
+ fileContents.push(content);
45
+ }
46
+ return {
47
+ fileContents,
48
+ fileNames,
49
+ };
50
+ }
51
+ async function getAllFiles(dirPath, supportedExtensions) {
52
+ const files = [];
53
+ const dirEntries = await fs.promises.readdir(dirPath, { withFileTypes: true });
54
+ const traversalPromises = dirEntries.map(async (entry) => {
55
+ const entryPath = path.join(dirPath, entry.name);
56
+ if (entry.isDirectory()) {
57
+ const subFiles = await getAllFiles(entryPath, supportedExtensions);
58
+ files.push(...subFiles);
59
+ }
60
+ else if (supportedExtensions.includes(path.extname(entryPath))) {
61
+ files.push(entryPath);
62
+ }
63
+ });
64
+ await Promise.all(traversalPromises);
65
+ return files;
66
+ }
67
+ const validate = async ({ rulesPath, dataPath }) => {
68
+ const rulesResult = await readFiles(rulesPath, RULE_FILE_SUPPORTED_EXTENSIONS);
69
+ const dataResult = await readFiles(dataPath, DATA_FILE_SUPPORTED_EXTENSIONS);
70
+ const payload = {
71
+ rules: rulesResult.fileContents,
72
+ data: dataResult.fileContents,
73
+ };
74
+ const validateBuilder = new guard_1.ValidateBuilder();
75
+ const result = validateBuilder
76
+ .payload(true)
77
+ .structured(true)
78
+ .showSummary([guard_1.ShowSummaryType.None])
79
+ .outputFormat(guard_1.OutputFormatType.Sarif)
80
+ .tryBuildAndExecute(JSON.stringify(payload));
81
+ return formatOutput({
82
+ result,
83
+ rulesNames: rulesResult.fileNames,
84
+ dataNames: dataResult.fileNames,
85
+ });
86
+ };
87
+ exports.validate = validate;