{"id":13749566,"url":"https://github.com/appcelerator-archive/titanium-code-processor","last_synced_at":"2025-05-09T12:33:17.972Z","repository":{"id":4568931,"uuid":"5710310","full_name":"appcelerator-archive/titanium-code-processor","owner":"appcelerator-archive","description":null,"archived":false,"fork":false,"pushed_at":"2015-06-18T15:32:16.000Z","size":9343,"stargazers_count":29,"open_issues_count":4,"forks_count":18,"subscribers_count":70,"default_branch":"master","last_synced_at":"2025-05-07T14:02:23.587Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appcelerator-archive.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-07T00:11:46.000Z","updated_at":"2023-10-01T17:50:50.000Z","dependencies_parsed_at":"2022-08-06T17:00:46.453Z","dependency_job_id":null,"html_url":"https://github.com/appcelerator-archive/titanium-code-processor","commit_stats":null,"previous_names":["appcelerator/titanium-code-processor"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator-archive%2Ftitanium-code-processor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator-archive%2Ftitanium-code-processor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator-archive%2Ftitanium-code-processor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator-archive%2Ftitanium-code-processor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appcelerator-archive","download_url":"https://codeload.github.com/appcelerator-archive/titanium-code-processor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253251970,"owners_count":21878607,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T07:01:05.853Z","updated_at":"2025-05-09T12:33:17.915Z","avatar_url":"https://github.com/appcelerator-archive.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"Titanium Code Processor [![Build Status](https://travis-ci.org/appcelerator/titanium-code-processor.png)](https://travis-ci.org/appcelerator/titanium-code-processor)\n=======================\n\nThe Titanium Code Processor is a tool for analyzing JavaScript code in\n[Titanium Mobile](https://github.com/appcelerator/titanium_mobile) projects. It\nprovide a wide variety of useful functionality, including runtime error detection,\nTitanium API deprecation warnings, platform specific API validation, and more.\nIt is built using a robust plugin solution that makes it relatively easy to add\nnew analyses to the code processor. The tool can be used as a stand-alone binary,\nused as part of the Titanium CLI, or incorporated as a library into other node.js\napplications (See the API documentation in the 'docs' folder for more\ninformation on using the code processor as a library).\n\nNote: In this document, whenever a data structure is defined, it uses the following convention:\n\n**[{name}]** [\u0026lt;optional\u0026gt;] _{type}_ [{description}]\n\nFields in [] are optional. If the type definition does not explicitly say \u0026lt;optional\u0026gt;, then it is required. If a\ntype has children, i.e. it is an object or array, then it's children are specified using indented lines immediately\nbelow the type definition. Object properties always have a name and array entries never have a name.\n\n## Table of Contents\n* [Quick Start](#quick-start)\n\t* [Install Using NPM](#install-using-npm)\n\t* [Run](#run)\n* [Running Using the CLI](#running-using-the-cli)\n\t* [Command Options](#command-options)\n\t* [Stream Output Format](#stream-output-format)\n\t\t* [Low Level Packet Format](#low-level-packet-format)\n\t\t* [High Level Packet Format](#high-level-packet-format)\n\t\t* [Message Types](#message-types)\n\t* [Config File](#config-file)\n* [Running as Part of a Build](#running-as-part-of-a-build)\n* [Runtime Options](#runtime-options)\n* [Built-in Plugins](#built-in-plugins)\n* [Internal Concepts](#internal-concepts)\n* [Running the ECMA-262 Unit Tests](#running-the-ecma-262-unit-tests)\n\n## Quick Start\n\n### Install Using NPM\n\n```\n[sudo] npm install -g titanium-code-processor\n```\n\nThe code processor works as a command in the [Titanium CLI](https://github.com/appcelerator/titanium), so make sure\nit is installed before continuing. If you have a 3.0.0. or newer Titanium SDK installed, you should already have the CLI.\nThere are two ways to include the code processor as part of the CLI:\n\nAutomatic Method: run the included install script\n\n```\nnode /path/to/titanium-code-processor/bin/install\n```\n\nManual Method: configure the cli by hand\n\n```\ntitanium config paths.commands --append /path/to/titanium-code-processor/commands\ntitanium config paths.hooks --append /path/to/titanium-code-processor/hooks\n```\n\nNote: On *NIX systems, the code processor is typically installed in /usr/local/lib/node_modules/titanium-code-processor\n\n### Run\n\nFrom within your project directory, run:\n\n```\ntitanium analyze -p iphone -A\n```\n\n## Running Using the CLI\n\n```\ntitanium analyze [options]\n```\nAnalyzes a project.\n\n### Command Options\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003cth\u003eOption\u003c/th\u003e\u003cth\u003eDescription\u003c/th\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e-A, --all-plugins\u003c/td\u003e\u003ctd\u003eloads all plugins in the default search path\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--exact-mode\u003c/td\u003e\u003ctd\u003eenables exact mode evaluation. Exact mode does not use ambiguous modes and throws an exception if an Unknown type is encountered (ignored if --config-file is specified)  [default: false]\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--no-console-passthrough\u003c/td\u003e\u003ctd\u003ePrevents console.* calls in a project from being logged to the console (ignored if --config-file is specified)  [default: false]\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--no-loop-evaluation\u003c/td\u003e\u003ctd\u003eWhether or not to evaluate loops (ignored if --config-file is specified)  [default: false]\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--no-method-invokation\u003c/td\u003e\u003ctd\u003eprevents methods from being invoked (ignored if --config-file is specified)  [default: false]\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--no-native-exception-recovery\u003c/td\u003e\u003ctd\u003edisables recovering from native exceptions when not in try/catch statements (ignored if --config-file is specified)  [default: false]\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--process-unvisited-code\u003c/td\u003e\u003ctd\u003ewhen set to true, all nodes and files that are not visited/skipped will be processed in ambiguous mode after all other code has been processed. While this will cause more of a project to be analyzed, this will decrease accuracy and can generate a lot of false positives (ignored if --config-file is specified)  [default: false]\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e-F, --config-file [value]\u003c/td\u003e\u003ctd\u003ethe path to the config file, note: most options and flags are ignored with this option\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--cycle-detection-stack-size [size]\u003c/td\u003e\u003ctd\u003ethe size of the cycle detection stack. Cycles that are larger than this size will not be caught  [default: 10000]\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--execution-time-limit [time limit]\u003c/td\u003e\u003ctd\u003ethe maximum time the app is allowed to run before erroring. 0 means no time limit (ignored if --config-file is specified)  [default: 300000]\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--log-level [level]\u003c/td\u003e\u003ctd\u003eminimum logging level (ignored if --config-file is specified)  [trace, debug, info, warn, error]\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--max-cycles [size]\u003c/td\u003e\u003ctd\u003eThe maximum number of cycles to allow before throwing an exception  [default: 200001]\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--max-loop-iterations [iterations]\u003c/td\u003e\u003ctd\u003ethe maximum number of iterations a loop can iterate before falling back to an unknown evaluation (ignored if --config-file is specified)  [default: 200000]\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--max-recursion-limit [recursion limit]\u003c/td\u003e\u003ctd\u003ethe maximum recursion depth to evaluate before throwing a RangeError exception (ignored if --config-file is specified)  [default: 500]\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e-o, --output [format]\u003c/td\u003e\u003ctd\u003eoutput format  [report, json, stream]\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e-p, --platform [platform]\u003c/td\u003e\u003ctd\u003ethe name of the OS being built-for, reflected in code via Ti.Platform.osname (ignored if --config-file is specified)\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e--plugins [plugins]\u003c/td\u003e\u003ctd\u003ea comma separated list of plugin names to load (ignored if --config-file is specified)\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e-d, --project-dir [value]\u003c/td\u003e\u003ctd\u003ethe directory containing the project, otherwise the current working directory (ignored if --config-file is specified)\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e-R, --results-dir [value]\u003c/td\u003e\u003ctd\u003ethe path to the directory that will contain the generated results pages (ignored if --config-file is specified)\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n### Stream Output Format\n\n```\ntitanium-code-processor subprocess \u003cpath/to/config/file\u003e\n```\nThe stream output format allows for JSON data to be passed in packets as the code processor runs. Data is passed back and forth using a custom two-layer packet format. The lower layer is completely custom, while the upper layer is formatted JSON and is encapsulated by the lower layer\n\n#### Low Level Packet Format\n\nThe low level packet consists of four comma separated fields that forms a message\n```\n[Message Type],[Sequence ID],[Message Length],[data]\n```\nNote: the packet header at this level is ASCII formatted, although the data can theoretically be in any format\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003cth\u003eName\u003c/th\u003e\u003cth\u003eDescription\u003c/th\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eMessageType\u003c/td\u003e\u003ctd\u003eA three character sequence that currently is always 'REQ' (request)\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eSequence ID\u003c/td\u003e\u003ctd\u003eA 32-bit, base 16 number that identifies the message. This value is always 8 characters long, and includes 0 padding if necessary.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eMessage Length\u003c/td\u003e\u003ctd\u003eA 32-bit, base 16 number that identifies the length of the message. This value is always 8 characters long, and includes 0 padding if necessary. Hex letters must be lower case.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eData\u003c/td\u003e\u003ctd\u003eThe data for the message as specified in the [High Level Packet Format](#high-level-packet-format) section\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\nExample:\n\n```\nREQ,000079AC,0000000C,{foo: 'bar'}\n```\n\n#### High Level Packet Format\n\nThe high level packet is just a JSON string. The contents of the JSON object vary depending on message type and context.\n\nA request always has the following definition:\n\n* **messageType** _string_ A free form string defining the type of message, and is typically the name of an event\n* **data** _any_ Any valid JSON value. Set to ```null``` if there is no data.\n\nExample:\n\n```JSON\n{\n\t\"messageType\": \"enteredFile\",\n\t\"data\": {\n\t\t\"filename\": \"path/to/file\"\n\t}\n}\n```\n\n#### Message Types\n\nThe code processor currently only sends one message, but others are planned for the future\n\n**results**\n\nThe results from the project\n\n* **errors** _array_ The errors from the project. The array is empty, but exists, if no errors were found\n\t* **type** _string_ The type of error\n\t* **description** _string_ A description of the error\n\t* **filename** _string_ The full path to the file where the error was detected\n\t* **line** _number_ The line number where the error was detected\n\t* **column** _number_ The column number where the error was detected\n* **warnings** _array_ The warnings from the project. The array is empty, but exists, if no warnings were found\n\t* **type** _string_ The type of warning\n\t* **description** _string_ A description of the warning\n\t* **filename** _string_ The full path to the file where the warning was detected\n\t* **line** _number_ The line number where the warning was detected\n\t* **column** _number_ The column number where the warning was detected\n* **plugins** _array_\n\t* **name** _string_ The name of the plugin, e.g. \"ti-api-deprecation-finder\"\n\t* **\u0026lt;other key\u0026gt;** Some other key specific to the plugin. See the plugin's README for detailed information\n* **elapsedTime** _number_ The amount of time it took to process the project, in ms\n* **resultsPath** _string_ The value of ```resultsPath``` passed to the code processor, for easy reference\n\nExample:\n\n```JSON\n{\n\t\"errors\": [{\n\t\t\"name\": \"SyntaxError\",\n\t\t\"description\": \"The description of the error\",\n\t\t\"data\": {\n\t\t\t\"otherKeys\": \"other data, including message, type, etc\"\n\t\t},\n\t\t\"filename\": \"path/to/file\",\n\t\t\"line\": 0,\n\t\t\"column\": 0,\n\t\t\"occurances\": 0\n\t}],\n\t\"warnings\": [{\n\t\t\"name\": \"SyntaxError\",\n\t\t\"description\": \"The description of the error\",\n\t\t\"data\": {\n\t\t\t\"otherKeys\": \"other data, including message, type, etc\"\n\t\t},\n\t\t\"filename\": \"path/to/file\",\n\t\t\"line\": 0,\n\t\t\"column\": 0,\n\t\t\"occurances\": 0\n\t}],\n\t\"plugins\": [{\n\t\t\"name\": \"plugin-name\",\n\t\t\"otherKeys\": \"other values\"\n\t}],\n\t\"elapsedTime\": 0,\n\t\"resultsPath\": \"resultsPath/from/config/file\"\n}\n```\n\n### Config File\n\nThe config file contains everything necessary for processing a project. Below is it's definition\n\n* **sourceInformation** _object_ The path to the entry point\n\t * **sourceDir** The directory containing the source code to be analyzed\n\t * **entryPoint** The entry point for the project\n\t * **projectDir** The project directory\n\t * **originalSourceDir** \u0026lt;optional\u0026gt; The original directory that contained source code. Source maps map from here to sourceDir\n\t * **sourceMaps** \u0026lt;optional\u0026gt; The source maps in key-value form. The key is a relative path to the file with sourceDir as the base, i.e. an absolute path to a file is at sourceDir + '/' + sourceMapKey\n* **logging** _object_ Logging configuration\n\t* **file** \u0026lt;optional\u0026gt; _object_ The configuration for logging to a file\n\t\t* **level** _string_ The log level, e.g. \"debug\"\n\t\t* **path** _string_ The full path to the log file. The file does not have to previously exist\n* **options** _object_ The options for the project. See [Runtime Options](#runtime-options) for details\n* **plugins** _array_ The plugins to load\n\t* _object_ The configuration for a plugin to load\n\t\t* **path** _string_ The path to the plugin\n\t\t* **options** _object_ The plugin options. See the plugin's README for details\n\nNote: all paths are relative to the CWD. ```~``` is not supported, and it is recommended to use absolute paths\n\nExample config file for an Alloy application:\n\n```JSON\n{\n\t\"sourceInformation\": {\n\t\t\"projectDir\": \"/path/to/project\",\n\t\t\"entryPoint\": \"path/to/project/Resources/app.js\",\n\t\t\"sourceDir\": \"/path/to/project/Resources\",\n\t\t\"sourceMaps\": \"/path/to/project/build/map/Resources\",\n\t\t\"originalSourceDir\": \"/path/to/project/app\"\n\t},\n\t\"logging\": {\n\t\t\"file\": {\n\t\t\t\"level\": \"debug\",\n\t\t\t\"path\": \"path/to/log\"\n\t\t}\n\t},\n\t\"options\": {\n\t\t\"resultsPath\": \"path/to/results/directory\",\n\t\t\"processUnvisitedCode\": true,\n\t\t\"maxRecursionLimit\": 500\n\t},\n\t\"plugins\": [\n\t\t{\n\t\t\t\"path\": \"path/to/common-globals\",\n\t\t\t\"options\": {}\n\t\t},\n\t\t{\n\t\t\t\"path\": \"path/to/require-provider\",\n\t\t\t\"options\": {\n\t\t\t\t\"platform\": \"iphone\",\n\t\t\t\t\"modules\": []\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t\"path\": \"path/to/ti-api-processor\",\n\t\t\t\"options\": {\n\t\t\t\t\"platform\": \"iphone\",\n\t\t\t\t\"sdkPath\": \"path/to/sdk\",\n\t\t\t\t\"values\": {\n\t\t\t\t\t\"Titanium.Platform.displayCaps.platformWidth\": 720\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t\"path\": \"path/to/ti-api-usage-finder\",\n\t\t\t\"options\": {}\n\t\t},\n\t\t{\n\t\t\t\"path\": \"path/to/ti-api-platform-validator\",\n\t\t\t\"options\": {\n\t\t\t\t\"platform\": \"iphone\"\n\t\t\t}\n\t\t}\n\t]\n}\n```\n\n## Running as Part of a Build\n\nThe code processor is integrated as a build step in the CLI. To enable it, add\nthe following to your tiapp.xml:\n\n```xml\n\u003ccode-processor\u003e\n\t\u003cenabled\u003etrue\u003c/enabled\u003e\n\u003c/code-processor\u003e\n```\n\nOptions and plugins can also be specified in the tiapp.xml, as the following\nexample shows:\n\n```xml\n\u003ccode-processor\u003e\n\t\u003cenabled\u003etrue\u003c/enabled\u003e\n\t\u003coptions\u003e\n\t\t\u003cnativeExceptionRecovery\u003etrue\u003c/nativeExceptionRecovery\u003e\n\t\t\u003cinvokeMethods\u003efalse\u003c/invokeMethods\u003e\n\t\u003c/options\u003e\n\t\u003cplugins\u003e\n\t\t\u003cplugin\u003erequire-provider\u003c/plugin\u003e\n\t\u003c/plugins\u003e\n\u003c/code-processor\u003e\n```\n\nRunning as part of a build will report errors and warnings, and is used in Mobile Web to compress the size of index.html\n\n## Runtime Options\n\nThese options can be set at the command line by using the '-c' flag from the code\nprocessor command, or by setting the option in the tiapp.xml file if using the\nTitanium CLI.\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003cth\u003ename\u003c/th\u003e\u003cth\u003etype\u003c/th\u003e\u003cth\u003edefault\u003c/th\u003e\u003cth\u003edescription\u003c/th\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003einvokeMethods\u003c/td\u003e\u003ctd\u003eboolean\u003c/td\u003e\u003ctd\u003etrue\u003c/td\u003e\u003ctd\u003eIndicates whether or not to invoke methods. If set to false, the method is evaluated once in ambiguous context mode.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eevaluateLoops\u003c/td\u003e\u003ctd\u003eboolean\u003c/td\u003e\u003ctd\u003etrue\u003c/td\u003e\u003ctd\u003eIndicates whether or not to evaluate loops. If set to false, the loop body and any loop conditionals are evaluated once in ambiguous block mode.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003emaxLoopIterations\u003c/td\u003e\u003ctd\u003einteger\u003c/td\u003e\u003ctd\u003e1000000000000\u003c/td\u003e\u003ctd\u003eThe maximum number of iterations of a loop to evaluate. If this threshold is exceeded, the block is evaluated once in ambiguous block mode. Note: this threshold makes it impossible to analyze infinite loops.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003emaxRecursionLimit\u003c/td\u003e\u003ctd\u003einteger\u003c/td\u003e\u003ctd\u003e1000\u003c/td\u003e\u003ctd\u003eThe maximum function call depth to evaluate, similar to a stack size limit. If this threshold is exceeded, function bodies are not evaluated and unknown is returned. Note: this threshold makes it impossible to analyze infinite recursion.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003elogConsoleCalls\u003c/td\u003e\u003ctd\u003eboolean\u003c/td\u003e\u003ctd\u003etrue\u003c/td\u003e\u003ctd\u003eIf enabled, all console.* calls in a user's code are logged to the terminal using the appropriate log level.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eexecutionTimeLimit\u003c/td\u003e\u003ctd\u003einteger\u003c/td\u003e\u003ctd\u003eundefined\u003c/td\u003e\u003ctd\u003eThe maximum time to execute the code before throwing an exception. If not defined, the code processor will run as long as it takes to complete the analysis.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eexactMode\u003c/td\u003e\u003ctd\u003eboolean\u003c/td\u003e\u003ctd\u003efalse\u003c/td\u003e\u003ctd\u003eEnables exact mode and causes the code processor act exactly like a standard JavaScript interpreter. Intended primarily for unit testing and is not recommended for project .analysis\u003c/td\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003enativeExceptionRecovery\u003c/td\u003e\u003ctd\u003eboolean\u003c/td\u003e\u003ctd\u003efalse\u003c/td\u003e\u003ctd\u003eWhen enabled, the code processor will recover from many types of native exceptions and continue analysis. Enabling this has the potential of generating incorrect results, but can be used to parse code that normally wouldn't be parsed because of an error.\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n## Built-in Plugins\n\nPlugins are informally grouped into two types: analyzers and providers. Providers\nprovide some sort of feature in the runtime that is not included in the ECMAScript\nspecification, such as the Titanium Mobile API. Providers do not report any\nresults. Analyzers do not provide any features in the runtime but instead analyze\ncode and do report results. Many analyzers depend on providers to work. All of the\ncurrent plugins are listed below, along with their type and if they have any other\ndependencies\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003cth\u003ename\u003c/th\u003e\u003cth\u003etype\u003c/th\u003e\u003cth\u003edependencies\u003c/th\u003e\u003cth\u003edescription\u003c/th\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ca href=\"plugins/common-globals\"\u003ecommon-globals\u003c/a\u003e\u003c/td\u003e\u003ctd\u003eprovider\u003c/td\u003e\u003ctd\u003e\u0026lt;none\u0026gt;\u003c/td\u003e\u003ctd\u003eProvides implementations for common globals that aren't part of the JavaScript spec but are provided on all Titanium Mobile platforms (setTimeout, console, etc).\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ca href=\"plugins/require-provider\"\u003erequire-provider\u003c/a\u003e\u003c/td\u003e\u003ctd\u003eprovider\u003c/td\u003e\u003ctd\u003e\u0026lt;none\u0026gt;\u003c/td\u003e\u003ctd\u003eProvides an implementation of ```require()``` that matches the Titanium Mobile implementation, including its inconsistencies with CommonJS.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ca href=\"plugins/require-finder\"\u003erequire-finder\u003c/a\u003e\u003c/td\u003e\u003ctd\u003eanalyzer\u003c/td\u003e\u003ctd\u003erequire-provider\u003c/td\u003e\u003ctd\u003eReports all files that are ```require()```'d in a project.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ca href=\"plugins/ti-api-provider\"\u003eti-api-provider\u003c/a\u003e\u003c/td\u003e\u003ctd\u003eprovider\u003c/td\u003e\u003ctd\u003erequire-provider, common-globals\u003c/td\u003e\u003ctd\u003eProvides an implementation of the Titanium Mobile API. This implementation reads the API documentation for the SDK used by the project to create the API implementation. As such, the SDK specified in the project's tiapp.xml file *must* be installed.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ca href=\"plugins/ti-api-deprecation-finder\"\u003eti-api-deprecation-finder\u003c/a\u003e\u003c/td\u003e\u003ctd\u003eanalyzer\u003c/td\u003e\u003ctd\u003eti-api-provider\u003c/td\u003e\u003ctd\u003eReports all deprecated APIs used by the project.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ca href=\"plugins/ti-api-platform-validator\"\u003eti-api-platform-validator\u003c/a\u003e\u003c/td\u003e\u003ctd\u003eanalyer\u003c/td\u003e\u003ctd\u003eti-api-provider\u003c/td\u003e\u003ctd\u003eReports all instances where a platform specific feature is used on the wrong platform, e.g. calling ```Ti.Android.createIntent``` on iOS.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ca href=\"plugins/ti-api-usage-finder\"\u003eti-api-usage-finder\u003c/a\u003e\u003c/td\u003e\u003ctd\u003eanalyzer\u003c/td\u003e\u003ctd\u003eti-api-provider\u003c/td\u003e\u003ctd\u003eReports all Titanium Mobile APIs used by the project.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ca href=\"plugins/ti-api-include-finder\"\u003eti-api-include-finder\u003c/a\u003e\u003c/td\u003e\u003ctd\u003eanalyzer\u003c/td\u003e\u003ctd\u003eti-api-provider\u003c/td\u003e\u003ctd\u003eReports all files that are ```Ti.include()```'d by the project.\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n## Internal Concepts\n\nAt the core of the code processor is an ECMAScript 5 interpreter that has been\nspecially designed to work offline. To make this work, two new concepts have\nbeen introduced: an 'unknown' data type and 'ambiguous modes.'\n\nThe unknown data type is pretty self-explanatory; it's a value that we don't know\nthe value of. For example, if the following code is run:\n\n```JavaScript\nvar x = Date.now();\n```\n\nx will be set to unknown since the date changes from run to run and isn't known\nat compile time. Operations on unknown values always produce unknown values. For\nexample, y evaluates to unknown in all of the following circumstances:\n\n```JavaScript\nvar x = Date.now(),\n\ty;\ny = x + 20;\ny = x \u003e 100;\ny = x.foo();\ny = x.toString();\ny = typeof x;\n```\n\nAmbiguous modes occur when we are evaluating code without knowing exactly how\nit is invoked. There are two types of ambiguous mode: ambiguous context mode and\nambiguous block mode.\n\nAn ambiguous context is a function or module that is invoked\nwithout knowing exactly how it was invoked. All callbacks passed to the Titanium\nAPI are evaluated as ambiguous contexts, and any functions called from an ambiguous\nblock is called as an ambiguous context. In the following example, y is set to\nunknown:\n\n```JavaScript\nvar y;\nsetTimeout(function () {\n\ty = 20;\n}, 10)\n```\n\nAn ambiguous block is a loop/conditional body that is evaluated without knowing\nthe exact circumstances it is evaluated in. If statements and while/do-while\nloops are evaluated as an ambiguous block if the conditional is unknown. For and\nfor-in loops are evaluated as an ambiguous block if some part of the iteration\nconditions are unknown. All assignments in an ambiguous block evaluate to unknown\nand all functions called from an ambiguous block are evaluated in an ambiguous\ncontext. In the following example, y is set to unknown:\n\n```JavaScript\nvar x = Date.now(),\n\ty;\nif (x) {\n\ty = 10;\n} else {\n\ty = 20;\n}\n```\n\n## Running the ECMA-262 Unit Tests\n\nThe ECMA working group, who maintains the ECMA-262 specification (the JavaScript spec), also maintains a series of unit\ntests. To run the unit tests:\n\n* Clone the test-262 [Mercurial Repository](http://hg.ecmascript.org/tests/test262/)\n\t* Note: you will need install [Mercurial](http://mercurial.selenic.com/) before you can clone the repository. Git will not work.\n* Add the following to your titanium config file at ~/.titanium/config.json:\n\n```JSON\n{\n\t\"code-processor\": {\n\t\t\"test\": {\n\t\t\t\"test-262-directory\": \"/path/to/test-262/repo\"\n\t\t}\n\t}\n}\n```\n\n* Run the test script at \u0026lt;titanium code processor dir\u0026gt;/tests/bin/tests\n\t* You can run ```tests --help``` to see options for controlling the test process\n\n## Contributing\n\nTitanium is an open source project.  Titanium wouldn't be where it is now without contributions by the community. Please consider forking this repo to improve, enhance or fix issues. If you feel like the community will benefit from your fork, please open a pull request.\n\nTo protect the interests of the Titanium contributors, Appcelerator, customers and end users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is simple and straightforward - it requires that the contributions you make to any Appcelerator open source project are properly licensed and that you have the legal authority to make those changes. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes only a few minutes, and only needs to be completed once.\n\n[You can digitally sign the CLA](http://bit.ly/app_cla) online. Please indicate your email address in your first pull request so that we can make sure that will locate your CLA.  Once you've submitted it, you no longer need to send one for subsequent submissions.\n\n#### (C) Copyright 2012-2013, [Appcelerator](http://www.appcelerator.com) Inc. All Rights Reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappcelerator-archive%2Ftitanium-code-processor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappcelerator-archive%2Ftitanium-code-processor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappcelerator-archive%2Ftitanium-code-processor/lists"}