Correspondance of codemirror modes, file extensions, and github flavored markdown code languages? - file-extension

I'd like to embed local files as code snippets in a static website I'm making with jade, marked and codemirror for syntax highlighing. I will write a jade filter to do this.
What it boils down to is that I need to come up with the codemirror mode and github flavored markdown language (what you write when you do ```language) from the file extension.
At least some codemirror modes correspond to gfm languages. Do all of them coincide?
Is there a list somewhere, or some rationale for the names?
Thanks

The mode/meta.js file in CodeMirror's distribution associates names with modes (via the CodeMirror.findModeByName function), and if you get CodeMirror version 4.8 (released yesterday), the gfm mode will use this list to try and use the right mode for fenced code blocks that declare a language.

This list from the Brackets matches file extension with cm mode. I've turned it into this:
{"groovy": "groovy",
"ini": "properties",
"properties": "properties",
"css": "css",
"scss": "css",
"html": "htmlmixed",
"htm": "htmlmixed",
"shtm": "htmlmixed",
"shtml": "htmlmixed",
"xhtml": "htmlmixed",
"cfm": "htmlmixed",
"cfml": "htmlmixed",
"cfc": "htmlmixed",
"dhtml": "htmlmixed",
"xht": "htmlmixed",
"tpl": "htmlmixed",
"twig": "htmlmixed",
"hbs": "htmlmixed",
"handlebars": "htmlmixed",
"kit": "htmlmixed",
"jsp": "htmlmixed",
"aspx": "htmlmixed",
"ascx": "htmlmixed",
"asp": "htmlmixed",
"master": "htmlmixed",
"cshtml": "htmlmixed",
"vbhtml": "htmlmixed",
"ejs": "htmlembedded",
"dust": "htmlembedded",
"erb": "htmlembedded",
"js": "javascript",
"jsx": "javascript",
"jsm": "javascript",
"_js": "javascript",
"vbs": "vbscript",
"vb": "vb",
"json": "javascript",
"xml": "xml",
"svg": "xml",
"wxs": "xml",
"wxl": "xml",
"wsdl": "xml",
"rss": "xml",
"atom": "xml",
"rdf": "xml",
"xslt": "xml",
"xsl": "xml",
"xul": "xml",
"xbl": "xml",
"mathml": "xml",
"config": "xml",
"plist": "xml",
"xaml": "xml",
"php": "php",
"php3": "php",
"php4": "php",
"php5": "php",
"phtm": "php",
"phtml": "php",
"ctp": "php",
"c": "clike",
"h": "clike",
"i": "clike",
"cc": "clike",
"cp": "clike",
"cpp": "clike",
"c++": "clike",
"cxx": "clike",
"hh": "clike",
"hpp": "clike",
"hxx": "clike",
"h++": "clike",
"ii": "clike",
"ino": "clike",
"cs": "clike",
"asax": "clike",
"ashx": "clike",
"java": "clike",
"scala": "clike",
"sbt": "clike",
"coffee": "coffeescript",
"cf": "coffeescript",
"cson": "coffeescript",
"_coffee": "coffeescript",
"clj": "clojure",
"cljs": "clojure",
"cljx": "clojure",
"pl": "perl",
"pm": "perl",
"rb": "ruby",
"ru": "ruby",
"gemspec": "ruby",
"rake": "ruby",
"py": "python",
"pyw": "python",
"wsgi": "python",
"sass": "sass",
"lua": "lua",
"sql": "sql",
"diff": "diff",
"patch": "diff",
"md": "markdown",
"markdown": "markdown",
"mdown": "markdown",
"mkdn": "markdown",
"yaml": "yaml",
"yml": "yaml",
"hx": "haxe",
"sh": "shell",
"command": "shell",
"bash": "shell"}

Related

Node.js frequent JavaScript heap out of memory crash on react-scripts-ts

I have an react + typescript project. Since a couple of weeks ago, my WebStorm IDE crashes (JavaScript heap out of memory) on every update that I make to the code. I'm using:
Node.js 12.3.1
TypeScript 3.7.5
React 16.12.0
react-scripts-ts 3.1.0
Webstorm 2021.2
and my OS is Windows 10.
I have also set the environment variable NODE_OPTIONS to --max-old-space-size=4096 according to multiple online resources. However it seems react-scripts-ts runs node.js with inline max-old-space-size=2048 (based on the error report below) and that causes the defined environment variable not to work.
Here is the error produced every time:
{
"header": {
"event": "Allocation failed - JavaScript heap out of memory",
"trigger": "FatalError",
"filename": "report.20211220.141006.15768.0.001.json",
"dumpEventTime": "2021-12-20T14:10:06Z",
"dumpEventTimeStamp": "1639996806776",
"processId": 15768,
"cwd": "D:\\GitProjects\\moein-ui",
"commandLine": [
"D:\\nodejs\\node.exe",
"--max-old-space-size=2048",
"D:\\GitProjects\\moein-ui\\node_modules\\fork-ts-checker-webpack-plugin\\lib\\service.js"
],
"nodejsVersion": "v12.3.1",
"wordSize": 64,
"arch": "x64",
"platform": "win32",
"componentVersions": {
"node": "12.3.1",
"v8": "7.4.288.27-node.18",
"uv": "1.29.1",
"zlib": "1.2.11",
"brotli": "1.0.7",
"ares": "1.15.0",
"modules": "72",
"nghttp2": "1.38.0",
"napi": "4",
"llhttp": "1.1.3",
"http_parser": "2.8.0",
"openssl": "1.1.1b",
"cldr": "35.1",
"icu": "64.2",
"tz": "2019a",
"unicode": "12.1"
},
"release": {
"name": "node",
"headersUrl": "https://nodejs.org/download/release/v12.3.1/node-v12.3.1-headers.tar.gz",
"sourceUrl": "https://nodejs.org/download/release/v12.3.1/node-v12.3.1.tar.gz",
"libUrl": "https://nodejs.org/download/release/v12.3.1/win-x64/node.lib"
},
"osName": "Windows_NT",
"osRelease": "10.0.15063",
"osVersion": "Windows 10 Enterprise",
"osMachine": "x86_64",
"host": "DESKTOP-MDD0UUA"
},
"javascriptStack": {
"message": "No stack.",
"stack": [
"Unavailable."
]
},
"nativeStack": [
{
"pc": "0x00007ff73dbd54e9",
"symbol": "std::basic_ostream<char,std::char_traits<char> >::operator<<+9161"
},
{
"pc": "0x00007ff73dbd8dd4",
"symbol": "std::basic_ostream<char,std::char_traits<char> >::operator<<+23732"
},
{
"pc": "0x00007ff73dbd7df8",
"symbol": "std::basic_ostream<char,std::char_traits<char> >::operator<<+19672"
},
{
"pc": "0x00007ff73dcc0c9b",
"symbol": "uv_loop_fork+48251"
},
{
"pc": "0x00007ff73dff8bce",
"symbol": "v8::internal::Parser::ReportMessageAt+206"
},
{
"pc": "0x00007ff73dfccc4a",
"symbol": "v8::internal::wasm::StreamingDecoder::Fail+666"
},
{
"pc": "0x00007ff73e06309c",
"symbol": "v8::internal::Heap::CreateFillerObjectAt+2972"
},
{
"pc": "0x00007ff73e06ae0f",
"symbol": "v8::internal::LocalEmbedderHeapTracer::NotifyV8MarkingWorklistWasEmpty+5375"
},
{
"pc": "0x00007ff73e061483",
"symbol": "v8::internal::Heap::CollectGarbage+1235"
},
{
"pc": "0x00007ff73e05fb84",
"symbol": "v8::internal::GCTracer::AddScopeSample+1316"
},
{
"pc": "0x00007ff73e0a07b3",
"symbol": "v8::internal::Factory::NewFillerObject+67"
},
{
"pc": "0x00007ff73e3c76e6",
"symbol": "v8::internal::OptimizingCompileDispatcher::Unblock+116966"
},
{
"pc": "0x00007ff73e862c16",
"symbol": "v8::internal::NativesCollection<0>::GetScriptsSource+662454"
}
],
"javascriptHeap": {
"totalMemory": 2168434688,
"totalCommittedMemory": 2168434688,
"usedMemory": 2083581904,
"availableMemory": 64011088,
"memoryLimit": 2197815296,
"heapSpaces": {
"read_only_space": {
"memorySize": 524288,
"committedMemory": 524288,
"capacity": 523976,
"used": 31712,
"available": 492264
},
"new_space": {
"memorySize": 33554432,
"committedMemory": 33554432,
"capacity": 16767232,
"used": 467608,
"available": 16299624
},
"old_space": {
"memorySize": 2002378752,
"committedMemory": 2002378752,
"capacity": 1954653600,
"used": 1953582240,
"available": 1071360
},
"code_space": {
"memorySize": 10649600,
"committedMemory": 10649600,
"capacity": 8994080,
"used": 8994080,
"available": 0
},
"map_space": {
"memorySize": 1576960,
"committedMemory": 1576960,
"capacity": 938480,
"used": 938480,
"available": 0
},
"large_object_space": {
"memorySize": 119701504,
"committedMemory": 119701504,
"capacity": 119564328,
"used": 119564328,
"available": 0
},
"code_large_object_space": {
"memorySize": 49152,
"committedMemory": 49152,
"capacity": 3456,
"used": 3456,
"available": 0
},
"new_large_object_space": {
"memorySize": 0,
"committedMemory": 0,
"capacity": 16767232,
"used": 0,
"available": 16767232
}
}
},
"resourceUsage": {
"userCpuSeconds": 348.5,
"kernelCpuSeconds": 4.718,
"cpuConsumptionPercent": 16.5055,
"maxRss": 2275651584,
"pageFaults": {
"IORequired": 1331208,
"IONotRequired": 0
},
"fsActivity": {
"reads": 7576,
"writes": 7
}
},
"libuv": [
],
"environmentVariables": {
"=C:": "C:\\",
"ALLUSERSPROFILE": "C:\\ProgramData",
"ANDROID_HOME": "D:\\Sdk",
"APPDATA": "C:\\Users\\farzad\\AppData\\Roaming",
"BABEL_ENV": "development",
"CHECK_SYNTACTIC_ERRORS": "false",
"ChocolateyInstall": "C:\\ProgramData\\chocolatey",
"ChocolateyLastPathUpdate": "132131941511207164",
"CommonProgramFiles": "C:\\Program Files\\Common Files",
"CommonProgramFiles(x86)": "C:\\Program Files (x86)\\Common Files",
"CommonProgramW6432": "C:\\Program Files\\Common Files",
"COMPUTERNAME": "DESKTOP-MDD0UUA",
"ComSpec": "C:\\Windows\\system32\\cmd.exe",
"dp0": "D:\\GitProjects\\moein-ui\\node_modules\\.bin\\",
"FPS_BROWSER_APP_PROFILE_STRING": "Internet Explorer",
"FPS_BROWSER_USER_PROFILE_STRING": "Default",
"HOME": "C:\\Users\\farzad",
"HOMEDRIVE": "C:",
"HOMEPATH": "\\Users\\farzad",
"IDEA_INITIAL_DIRECTORY": "C:\\Windows\\System32",
"INIT_CWD": "D:\\GitProjects\\moein-ui",
"IntelliJ IDEA": "D:\\JetBrains\\IntelliJ IDEA 2021.2.3\\bin;",
"JAVA_HOME": "D:\\Java\\jdk1.8.0_45",
"LOCALAPPDATA": "C:\\Users\\farzad\\AppData\\Local",
"LOGONSERVER": "\\\\DESKTOP-MDD0UUA",
"MEMORY_LIMIT": "2048",
"NODE": "D:\\nodejs\\node.exe",
"NODE_ENV": "development",
"NODE_OPTIONS=--max-old-space-size": "4096",
"NODE_PATH": "",
"npm_config_access": "",
"npm_config_allow_same_version": "",
"npm_config_also": "",
"npm_config_always_auth": "",
"npm_config_argv": "{\"remain\":[],\"cooked\":[\"start\"],\"original\":[\"start\"]}",
"npm_config_audit": "true",
"npm_config_audit_level": "low",
"npm_config_auth_type": "legacy",
"npm_config_before": "",
"npm_config_bin_links": "true",
"npm_config_browser": "",
"npm_config_ca": "",
"npm_config_cache": "C:\\Users\\farzad\\AppData\\Roaming\\npm-cache",
"npm_config_cache_lock_retries": "10",
"npm_config_cache_lock_stale": "60000",
"npm_config_cache_lock_wait": "10000",
"npm_config_cache_max": "Infinity",
"npm_config_cache_min": "10",
"npm_config_cafile": "",
"npm_config_cert": "",
"npm_config_cidr": "",
"npm_config_color": "true",
"npm_config_commit_hooks": "true",
"npm_config_depth": "Infinity",
"npm_config_description": "true",
"npm_config_dev": "",
"npm_config_dry_run": "",
"npm_config_editor": "notepad.exe",
"npm_config_engine_strict": "",
"npm_config_fetch_retries": "2",
"npm_config_fetch_retry_factor": "10",
"npm_config_fetch_retry_maxtimeout": "60000",
"npm_config_fetch_retry_mintimeout": "10000",
"npm_config_force": "",
"npm_config_git": "git",
"npm_config_git_tag_version": "true",
"npm_config_global": "",
"npm_config_globalconfig": "C:\\Users\\farzad\\AppData\\Roaming\\npm\\etc\\npmrc",
"npm_config_globalignorefile": "C:\\Users\\farzad\\AppData\\Roaming\\npm\\etc\\npmignore",
"npm_config_global_style": "",
"npm_config_group": "",
"npm_config_ham_it_up": "",
"npm_config_heading": "npm",
"npm_config_https_proxy": "",
"npm_config_if_present": "",
"npm_config_ignore_prepublish": "",
"npm_config_ignore_scripts": "",
"npm_config_init_author_email": "",
"npm_config_init_author_name": "",
"npm_config_init_author_url": "",
"npm_config_init_license": "ISC",
"npm_config_init_module": "C:\\Users\\farzad\\.npm-init.js",
"npm_config_init_version": "1.0.0",
"npm_config_json": "",
"npm_config_key": "",
"npm_config_legacy_bundling": "",
"npm_config_link": "",
"npm_config_local_address": "",
"npm_config_loglevel": "notice",
"npm_config_logs_max": "10",
"npm_config_long": "",
"npm_config_maxsockets": "50",
"npm_config_message": "%s",
"npm_config_metrics_registry": "https://registry.npmjs.org/",
"npm_config_node_gyp": "D:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js",
"npm_config_node_options": "",
"npm_config_node_version": "12.3.1",
"npm_config_noproxy": "",
"npm_config_offline": "",
"npm_config_onload_script": "",
"npm_config_only": "",
"npm_config_optional": "true",
"npm_config_otp": "",
"npm_config_package_lock": "true",
"npm_config_package_lock_only": "",
"npm_config_parseable": "",
"npm_config_prefer_offline": "",
"npm_config_prefer_online": "",
"npm_config_prefix": "C:\\Users\\farzad\\AppData\\Roaming\\npm",
"npm_config_preid": "",
"npm_config_production": "",
"npm_config_progress": "true",
"npm_config_proxy": "",
"npm_config_read_only": "",
"npm_config_rebuild_bundle": "true",
"npm_config_registry": "https://registry.npmjs.org/",
"npm_config_rollback": "true",
"npm_config_save": "true",
"npm_config_save_bundle": "",
"npm_config_save_dev": "",
"npm_config_save_exact": "",
"npm_config_save_optional": "",
"npm_config_save_prefix": "^",
"npm_config_save_prod": "",
"npm_config_scope": "",
"npm_config_scripts_prepend_node_path": "warn-only",
"npm_config_script_shell": "",
"npm_config_searchexclude": "",
"npm_config_searchlimit": "20",
"npm_config_searchopts": "",
"npm_config_searchstaleness": "900",
"npm_config_send_metrics": "",
"npm_config_shell": "C:\\Windows\\system32\\cmd.exe",
"npm_config_shrinkwrap": "true",
"npm_config_sign_git_commit": "",
"npm_config_sign_git_tag": "",
"npm_config_sso_poll_frequency": "500",
"npm_config_sso_type": "oauth",
"npm_config_strict_ssl": "true",
"npm_config_tag": "latest",
"npm_config_tag_version_prefix": "v",
"npm_config_timing": "",
"npm_config_tmp": "C:\\Users\\farzad\\AppData\\Local\\Temp",
"npm_config_umask": "0000",
"npm_config_unicode": "",
"npm_config_unsafe_perm": "true",
"npm_config_update_notifier": "true",
"npm_config_usage": "",
"npm_config_user": "",
"npm_config_userconfig": "C:\\Users\\farzad\\.npmrc",
"npm_config_user_agent": "npm/6.9.0 node/v12.3.1 win32 x64",
"npm_config_version": "",
"npm_config_versions": "",
"npm_config_viewer": "browser",
"npm_execpath": "D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js",
"npm_lifecycle_event": "start",
"npm_lifecycle_script": "react-scripts-ts start",
"npm_node_execpath": "D:\\nodejs\\node.exe",
"npm_package_dependencies_ace_builds": "1.4.8",
"npm_package_dependencies_antlr4": "4.8.0",
"npm_package_dependencies_axios": "0.19.2",
"npm_package_dependencies_babel_polyfill": "6.26.0",
"npm_package_dependencies_brace": "0.11.1",
"npm_package_dependencies_file_saver": "2.0.2",
"npm_package_dependencies_glamor": "2.20.40",
"npm_package_dependencies_highcharts": "7.1.2",
"npm_package_dependencies_highcharts_react_official": "2.2.2",
"npm_package_dependencies_jalali_moment": "3.3.3",
"npm_package_dependencies_jspdf": "1.5.3",
"npm_package_dependencies_lodash": "4.17.15",
"npm_package_dependencies_minimist": "1.2.5",
"npm_package_dependencies_react": "16.12.0",
"npm_package_dependencies_react_ace": "8.0.0",
"npm_package_dependencies_react_dnd": "7.4.5",
"npm_package_dependencies_react_dnd_html5_backend": "7.4.4",
"npm_package_dependencies_react_dom": "16.12.0",
"npm_package_dependencies_react_grid_layout": "1.1.0",
"npm_package_dependencies_react_redux": "7.0.3",
"npm_package_dependencies_react_resize_detector": "4.2.1",
"npm_package_dependencies_react_scripts_ts": "3.1.0",
"npm_package_dependencies_redux": "4.0.1",
"npm_package_dependencies_rgbcolor": "1.0.1",
"npm_package_dependencies_rtl_css_js": "1.14.0",
"npm_package_dependencies_stackblur": "1.0.0",
"npm_package_dependencies_timeago_js": "4.0.2",
"npm_package_dependencies_timeago_react": "3.0.1",
"npm_package_dependencies__stomp_stompjs": "6.1.0",
"npm_package_dependencies__webscopeio_react_textarea_autocomplete": "4.6.2",
"npm_package_description": "This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).",
"npm_package_devDependencies_enzyme": "3.10.0",
"npm_package_devDependencies_enzyme_adapter_react_16": "1.15.1",
"npm_package_devDependencies_npm_check_updates": "4.0.1",
"npm_package_devDependencies_npm_run_all": "4.1.5",
"npm_package_devDependencies_source_map_explorer": "2.2.2",
"npm_package_devDependencies_typescript": "3.7.5",
"npm_package_devDependencies_type_zoo": "3.4.1",
"npm_package_devDependencies__types_enzyme": "3.10.4",
"npm_package_devDependencies__types_enzyme_adapter_react_16": "1.0.5",
"npm_package_devDependencies__types_file_saver": "2.0.1",
"npm_package_devDependencies__types_jest": "26.0.19",
"npm_package_devDependencies__types_jspdf": "1.3.3",
"npm_package_devDependencies__types_lodash": "4.14.149",
"npm_package_devDependencies__types_memoize_one": "5.1.2",
"npm_package_devDependencies__types_minimist": "1.2.1",
"npm_package_devDependencies__types_node": "12.12.20",
"npm_package_devDependencies__types_react": "16.9.16",
"npm_package_devDependencies__types_react_dom": "16.9.4",
"npm_package_devDependencies__types_react_grid_layout": "1.1.0",
"npm_package_devDependencies__types_react_resize_detector": "4.2.0",
"npm_package_devDependencies__types_webscopeio__react_textarea_autocomplete": "4.6.3",
"npm_package_gitHead": "a9f423235f35dee06be56d5e518a3214b1bfccd9",
"npm_package_jest_moduleFileExtensions_0": "tsx",
"npm_package_jest_moduleFileExtensions_1": "ts",
"npm_package_jest_moduleFileExtensions_2": "js",
"npm_package_jest_moduleFileExtensions_3": "jsx",
"npm_package_jest_moduleNameMapper__Formula_ace_exportUtils_highchartsLoader__": "<rootDir>/__mocks__/fileMock.js",
"npm_package_jest_moduleNameMapper____css_less__": "<rootDir>/__mocks__/styleMock.js",
"npm_package_jest_moduleNameMapper____jpg_jpeg_png_gif_eot_otf_webp_svg_ttf_woff_woff2_mp4_webm_wav_mp3_m4a_aac_oga__": "<rootDir>/__mocks__/fileMock.js",
"npm_package_jest_testMatch_0": "<rootDir>/src/**/*.test.(tsx|ts)",
"npm_package_jest_testURL": "http://localhost/",
"npm_package_jest_transform___ts_tsx_": "ts-jest",
"npm_package_name": "moein-ui",
"npm_package_private": "true",
"npm_package_readmeFilename": "README.md",
"npm_package_scripts_analyse": "source-map-explorer build/static/js/main.*",
"npm_package_scripts_antrl4": "npm-run-all -s compositeEventFormula compositeKpiFormula",
"npm_package_scripts_autofix": "tslint --project . --fix",
"npm_package_scripts_build": "react-scripts-ts build",
"npm_package_scripts_compositeEventFormula=antlr4 -Dlanguage": "JavaScript -no-listener -o src/lib/input/code/compositeEventFormula src/lib/input/code/compositeEventFormula/CompositeEventFormula.g4",
"npm_package_scripts_compositeKpiFormula=antlr4 -Dlanguage": "JavaScript -no-listener -o src/lib/input/code/compositeKpiFormula src/lib/input/code/compositeKpiFormula/CompositeKpiFormula.g4",
"npm_package_scripts_eject": "react-scripts-ts eject",
"npm_package_scripts_lint": "tslint --project .",
"npm_package_scripts_ncu": "ncu -i -u --removeRange",
"npm_package_scripts_postinstall": "node ./scripts/injectGlamorPlugins.js",
"npm_package_scripts_start": "react-scripts-ts start",
"npm_package_scripts_test=jest --setupTestFrameworkScriptFile=raf/polyfill --forceExit --ci -w": "2 --logHeapUsage",
"npm_package_scripts_update_kpis": "node ./scripts/updateKpis.js",
"npm_package_version": "1.7.2",
"NUMBER_OF_PROCESSORS": "8",
"OneDrive": "C:\\Users\\farzad\\OneDrive",
"OS": "Windows_NT",
"Path": "D:\\nodejs\\node_modules\\npm\\node_modules\\npm-lifecycle\\node-gyp-bin;D:\\GitProjects\\moein-ui\\node_modules\\.bin;C:\\ProgramData\\DockerDesktop\\version-bin;C:\\Program Files\\Docker\\Docker\\Resources\\bin;C:\\Python27\\;C:\\Python27\\Scripts;D:\\MiKTeX 2.9\\miktex\\bin;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\MySQL\\MySQL Fabric 1.5 & MySQL Utilities 1.5\\;C:\\Program Files (x86)\\MySQL\\MySQL Fabric 1.5 & MySQL Utilities 1.5\\Doctrine extensions for PHP\\;D:\\nodejs\\node-v8.11.1-win-x64;%JAVA_HOME%\\bin\\;D:\\Git\\bin;C:\\ProgramData\\chocolatey\\bin;D:\\Sdk\\platform-tools;D:\\Git\\usr\\bin;D:\\nodejs\\;C:\\Users\\farzad\\AppData\\Local\\Microsoft\\WindowsApps;D:\\Behsazan VPN\\Sophos SSL VPN Client\\bin;D:\\JetBrains\\IntelliJ IDEA 2021.2.3\\bin;;C:\\Users\\farzad\\AppData\\Roaming\\npm",
"PATHEXT": ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JSE;.WSF;.WSH;.MSC",
"PROCESSOR_ARCHITECTURE": "AMD64",
"PROCESSOR_IDENTIFIER": "Intel64 Family 6 Model 158 Stepping 9, GenuineIntel",
"PROCESSOR_LEVEL": "6",
"PROCESSOR_REVISION": "9e09",
"ProgramData": "C:\\ProgramData",
"ProgramFiles": "C:\\Program Files",
"ProgramFiles(x86)": "C:\\Program Files (x86)",
"ProgramW6432": "C:\\Program Files",
"PROMPT": "$P$G",
"PSModulePath": "C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules",
"PUBLIC": "C:\\Users\\Public",
"REACT_APP_DEBUG": "true",
"REACT_APP_VERSION": "1.7.2",
"SESSIONNAME": "Console",
"SystemDrive": "C:",
"SystemRoot": "C:\\Windows",
"TEMP": "C:\\Users\\farzad\\AppData\\Local\\Temp",
"TMP": "C:\\Users\\farzad\\AppData\\Local\\Temp",
"TSCONFIG": "D:\\GitProjects\\moein-ui\\tsconfig.json",
"TSLINT": "D:\\GitProjects\\moein-ui\\tslint.json",
"USERDOMAIN": "DESKTOP-MDD0UUA",
"USERDOMAIN_ROAMINGPROFILE": "DESKTOP-MDD0UUA",
"USERNAME": "farzad",
"USERPROFILE": "C:\\Users\\farzad",
"VBOX_MSI_INSTALL_PATH": "D:\\VirtualBox\\",
"WATCH": "D:\\GitProjects\\moein-ui\\src",
"windir": "C:\\Windows",
"WORK_DIVISION": "1",
"_prog": "node"
},
"sharedObjects": [
"D:\\nodejs\\node.exe",
"C:\\Windows\\SYSTEM32\\ntdll.dll",
"C:\\Windows\\System32\\KERNEL32.DLL",
"C:\\Windows\\System32\\KERNELBASE.dll",
"C:\\Windows\\System32\\WS2_32.dll",
"C:\\Windows\\System32\\sechost.dll",
"C:\\Windows\\System32\\RPCRT4.dll",
"C:\\Windows\\System32\\ADVAPI32.dll",
"C:\\Windows\\System32\\msvcrt.dll",
"C:\\Windows\\System32\\USER32.dll",
"C:\\Windows\\System32\\win32u.dll",
"C:\\Windows\\System32\\GDI32.dll",
"C:\\Windows\\SYSTEM32\\dbghelp.dll",
"C:\\Windows\\System32\\gdi32full.dll",
"C:\\Windows\\System32\\ucrtbase.dll",
"C:\\Windows\\System32\\msvcp_win.dll",
"C:\\Windows\\System32\\PSAPI.DLL",
"C:\\Windows\\System32\\CRYPT32.dll",
"C:\\Windows\\System32\\MSASN1.dll",
"C:\\Windows\\SYSTEM32\\IPHLPAPI.DLL",
"C:\\Windows\\SYSTEM32\\USERENV.dll",
"C:\\Windows\\SYSTEM32\\bcrypt.dll",
"C:\\Windows\\System32\\profapi.dll",
"C:\\Windows\\SYSTEM32\\WINMM.dll",
"C:\\Windows\\SYSTEM32\\winmmbase.dll",
"C:\\Windows\\System32\\cfgmgr32.dll",
"C:\\Windows\\System32\\IMM32.DLL",
"C:\\Windows\\System32\\powrprof.dll",
"C:\\Windows\\system32\\uxtheme.dll",
"C:\\Windows\\System32\\combase.dll",
"C:\\Windows\\System32\\bcryptPrimitives.dll",
"C:\\Windows\\system32\\mswsock.dll",
"C:\\Windows\\System32\\kernel.appcore.dll",
"C:\\Windows\\system32\\napinsp.dll",
"C:\\Windows\\system32\\pnrpnsp.dll",
"C:\\Windows\\system32\\NLAapi.dll",
"C:\\Windows\\SYSTEM32\\DNSAPI.dll",
"C:\\Windows\\System32\\NSI.dll",
"C:\\Windows\\System32\\winrnr.dll"
]
}
Appreciate any help in advance.
From the log it seems that this is fork-ts-checker-webpack-plugin that runs out of memory.
You can try specifying the memory limit in your custom .fork-ts-checkerrc file per instructions in https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#typescript-options

How to merge JSON files in Sublime Text

Currently I'm using a custom task.json file to compile and run C and C++ code in Linux:
{
"version": "2.0.0",
"tasks": [
{
"label": "PIYUSH Compiler",
"type": "shell",
"command": "g++",
"args": [
"-g",
"${relativeFile}",
"-o",
"${fileBasenameNoExtension}.out",
"&&",
"clear",
"&&",
"./${fileBasenameNoExtension}.out"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
]
}
Now there is a build file from Sublime text:
{
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"shell_cmd": "python3 /home/piyush/Documents/CPHelper/Main.py\"${file_path}/${file_base_name}\""
}
]
}
I want a JSON file to merge both my custom task.json file and this Sublime Text build file in a single task.json file.
How to do it?

Extract elements from JSON

I got small web scraper that I use to scrape websites, it captures information such as
Web Content
Page Technology
Headers
Cookies
Requests
Now i am working in AWS Lambda and trying to extract elements but struggling to parse the data correctly.
To get the data i do
const parsedData = JSON.parse(data);
if i then do
console.log(parsedData)
I get a valid JSON object (shortened for readability)
{
"Scrape": {
"PageContent": [
{
"tag": "title",
"text": "Stack Overflow - Where Developers Learn, Share, & Build Careers"
},
{
"tag": "span",
"text": "Stack Overflow"
},
{
"tag": "span",
"text": "new"
},
{
"tag": "h4",
"text": "Try Stack Overflow for Business"
},
{
"tag": "span",
"text": "rev 2019.5.3.33574"
}
],
"PageTech": [
{
"name": "DoubleClick for Publishers (DFP)",
"confidence": "100",
"version": null,
"icon": "DoubleClick.svg",
"website": "http://www.google.com/dfp",
"categories": [
{
"36": "Advertising Networks"
}
]
},
{
"name": "Elementor",
"confidence": "100",
"version": null,
"icon": "Elementor.png",
"website": "https://elementor.com",
"categories": [
{
"51": "Landing Page Builders"
}
]
},
{
"name": "MySQL",
"confidence": "0",
"version": null,
"icon": "MySQL.svg",
"website": "http://mysql.com",
"categories": [
{
"34": "Databases"
}
]
}
],
"PageHeaders": {
"status": [
"200"
],
"cache-control": [
"private"
],
"content-type": [
"text/html; charset=utf-8"
],
"content-encoding": [
"gzip"
],
"x-frame-options": [
"SAMEORIGIN"
],
"x-request-guid": [
"f7b0f406-a047-49b0-a822-18549cec5510"
],
"strict-transport-security": [
"max-age=15552000"
],
"content-security-policy": [
"upgrade-insecure-requests"
],
"accept-ranges": [
"bytes"
],
"date": [
"Sat, 04 May 2019 15:31:45 GMT"
],
"via": [
"1.1 varnish"
],
"x-served-by": [
"cache-dca17748-DCA"
],
"x-cache": [
"MISS"
],
"x-cache-hits": [
"0"
],
"x-timer": [
"S1556983905.306505,VS0,VE17"
],
"vary": [
"Accept-Encoding,Fastly-SSL"
],
"x-dns-prefetch-control": [
"off"
],
"set-cookie": [
"prov=c352d0ff-77bc-1152-f587-c60c5b156354; domain=.stackoverflow.com; expires=Fri, 01-Jan-2055 00:00:00 GMT; path=/; HttpOnly"
],
"content-length": [
"52808"
]
},
"PageCookies": [
{
"name": "__qca",
"value": "P0-513591828-1556983906778",
"domain": ".stackoverflow.com",
"path": "/",
"expires": 1590852706,
"size": 31,
"httpOnly": false,
"secure": false,
"session": false
},
{
"name": "prov",
"value": "c352d0ff-77bc-1152-f587-c60c5b156354",
"domain": ".stackoverflow.com",
"path": "/",
"expires": 2682374400.32448,
"size": 40,
"httpOnly": true,
"secure": false,
"session": false
},
{
"name": "notice-so4",
"value": "!1",
"domain": "stackoverflow.com",
"path": "/",
"expires": 1558620000,
"size": 12,
"httpOnly": false,
"secure": false,
"session": false
}
],
"PageRequests": [
{},
"request url:",
"https://stackoverflow.com/",
"request url:",
"https://csi.gstatic.com/csi?s=ampad&ctx=2&puid=1~1556983907538&qqid=CNPSx4WZguICFREahgodlIgJLA&rt=a4a.link.i.43.8.2.1s.0.1ncx.1mpg~aa.script.j.4c.b.8.0.0.toq.tl3~simg.img.z.1w.1.5.0.0.bob.bjn~vu.img.z.29.2.h.0.0.87.0&met.a4a=dcl.0~ol.423~nvs.1556983907063~ini.1556983907539",
"request url:",
"https://pagead2.googlesyndication.com/pcs/activeview?xai=AKAOjssfcs88N7qDU9Qt-wDm3tVGQ1IHYMTJIMVe7GXXRffOfT5bDoX5Q2J-38ZpgGqsphazKd2DBC22PTJF-bHEAW9artqsaPzETpUg8026EaA&sig=Cg0ArKJSzNKjZvqCXbUqEAE&id=ampim&o=1268,478&d=300,250&ss=800,600&bs=1920,1080&mcvt=1019&mtos=0,0,1019,1019,1019&tos=0,0,1019,0,0&tfs=136&tls=1155&g=100&h=100&pt=423&tt=1168&rpt=423&rst=1556983907063&r=v&adk=2451320170&avms=ampa"
]
}
}
When i try to extract the information from the JSON i keep getting
undefined
value back.
Examples i have tried is
console.log(parsedData.Scrape.PageContent)
console.log(parsedData.Scrape.PageContent[0].text
console.log(parsedData[1][1])
console.log(parsedData.Scrape)
console.log(parsedData[1]['Scrape'])
Expected output is the be able to get individual elements so i can write them to a DB

JSHint options do not apply (Sublime3)

I've installed SublimeLinter and SublimeLinter-jshint and JSHint itself works. However, i'm not able to configure JSHint. I tried to add jshint settings to SublimeLinter.sublime-settings but it seems that there is no effect on JSHint.
This is what my settings (Preferences > Package Settings > SublimeLinter > Settings - User) look like:
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"jshint": {
"#disable": false,
"args": [],
"excludes": [],
"maxdepth": 1,
"strict": "global",
"sub": true
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"passive_warnings": false,
"paths": {
"linux": [],
"osx": [],
"windows": []
},
"python_paths": {
"linux": [],
"osx": [],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"javascript (babel)": "javascript",
"magicpython": "python",
"php": "html",
"python django": "python",
"pythonimproved": "python"
},
"warning_color": "DDB700",
"wrap_find": true
}
}
I've added some example settings like '"maxdepth": 1', but these rules do not apply. What is missing here?
From the Settings section of the README on Github, also available on the Package Control page:
You can configure jshint options in the way you would from the command line, with .jshintrc files. For more information, see the jshint docs. The linter plugin does this by searching for a .jshintrc file [...]
Read the full section and the linked docs for all the directions, then place a .jshintrc file where appropriate for your project.

SublimeLinter ignore missing semicolons

I'm using a non-semicolon based coding style in one of my node apps, but the problem is SublimeLinter is logging all the missing semicolons, and eventually stops with a "Too many errors" error, and stops linting the rest of the script.
I've tried adding an ignore_match object to both the default and user settings, but nothing works. I've also restarted after each time I've tried just to make sure.
I've even tried adding it to the excludes portion of the settings.
This is the resource I was using:
Linter Settings
Here is one of the errors I'm getting:
Z:\www\site\node\workers.js: line 162, col 2, Missing semicolon. (W033)
Here's my settings: From User.
{
"user": {
"debug": true,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"ignore_match": [
"Missing semicolon."
],
"lint_mode": "background",
"linters": {
"annotations": {
"#disable": false,
"args": [],
"errors": [
"FIXME"
],
"excludes": ["Missing semicolon"],
"warnings": [
"TODO",
"README"
]
},
"jshint": {
"#disable": false,
"args": [],
"excludes": ["Missing semicolon"]
},
"php": {
"#disable": false,
"args": [],
"excludes": []
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"passive_warnings": false,
"paths": {
"linux": [],
"osx": [],
"windows": []
},
"python_paths": {
"linux": [],
"osx": [],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"php": "html",
"python django": "python"
},
"warning_color": "DDB700",
"wrap_find": true
}
}
EDIT:
Added ignore_match": ["Missing semicolon"] to the jshint options. It became:
"jshint": {
"#disable": false,
"args": [],
"excludes": [],
"ignore_match": ["Missing semicolon"]
},
Complete answer,
Full user settings json file:
{
"user": {
"linters": {
"jshint": {
"#disable": false,
"ignore_match": [
".*Missing.*",
]
},
}
}
}
Easy answer:
Add ignore_match": ["Missing semicolon"] to jshint options.
"jshint": {
"#disable": false,
"args": [],
"excludes": [],
"ignore_match": ["Missing semicolon"]
},

Resources