102 lines
9.1 KiB
JSON
102 lines
9.1 KiB
JSON
|
{
|
|||
|
"_args": [
|
|||
|
[
|
|||
|
{
|
|||
|
"raw": "js-tokens@^3.0.0",
|
|||
|
"scope": null,
|
|||
|
"escapedName": "js-tokens",
|
|||
|
"name": "js-tokens",
|
|||
|
"rawSpec": "^3.0.0",
|
|||
|
"spec": ">=3.0.0 <4.0.0",
|
|||
|
"type": "range"
|
|||
|
},
|
|||
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/loose-envify"
|
|||
|
]
|
|||
|
],
|
|||
|
"_from": "js-tokens@>=3.0.0 <4.0.0",
|
|||
|
"_id": "js-tokens@3.0.2",
|
|||
|
"_inCache": true,
|
|||
|
"_location": "/js-tokens",
|
|||
|
"_nodeVersion": "7.10.0",
|
|||
|
"_npmOperationalInternal": {
|
|||
|
"host": "s3://npm-registry-packages",
|
|||
|
"tmp": "tmp/js-tokens-3.0.2.tgz_1498683256536_0.7391157897654921"
|
|||
|
},
|
|||
|
"_npmUser": {
|
|||
|
"name": "lydell",
|
|||
|
"email": "simon.lydell@gmail.com"
|
|||
|
},
|
|||
|
"_npmVersion": "4.2.0",
|
|||
|
"_phantomChildren": {},
|
|||
|
"_requested": {
|
|||
|
"raw": "js-tokens@^3.0.0",
|
|||
|
"scope": null,
|
|||
|
"escapedName": "js-tokens",
|
|||
|
"name": "js-tokens",
|
|||
|
"rawSpec": "^3.0.0",
|
|||
|
"spec": ">=3.0.0 <4.0.0",
|
|||
|
"type": "range"
|
|||
|
},
|
|||
|
"_requiredBy": [
|
|||
|
"/loose-envify"
|
|||
|
],
|
|||
|
"_resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
|
|||
|
"_shasum": "9866df395102130e38f7f996bceb65443209c25b",
|
|||
|
"_shrinkwrap": null,
|
|||
|
"_spec": "js-tokens@^3.0.0",
|
|||
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/loose-envify",
|
|||
|
"author": {
|
|||
|
"name": "Simon Lydell"
|
|||
|
},
|
|||
|
"bugs": {
|
|||
|
"url": "https://github.com/lydell/js-tokens/issues"
|
|||
|
},
|
|||
|
"dependencies": {},
|
|||
|
"description": "A regex that tokenizes JavaScript.",
|
|||
|
"devDependencies": {
|
|||
|
"coffee-script": "~1.12.6",
|
|||
|
"esprima": "^4.0.0",
|
|||
|
"everything.js": "^1.0.3",
|
|||
|
"mocha": "^3.4.2"
|
|||
|
},
|
|||
|
"directories": {},
|
|||
|
"dist": {
|
|||
|
"shasum": "9866df395102130e38f7f996bceb65443209c25b",
|
|||
|
"tarball": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz"
|
|||
|
},
|
|||
|
"files": [
|
|||
|
"index.js"
|
|||
|
],
|
|||
|
"gitHead": "8315904c840b14d28de1b0a4968194555f61bea3",
|
|||
|
"homepage": "https://github.com/lydell/js-tokens#readme",
|
|||
|
"keywords": [
|
|||
|
"JavaScript",
|
|||
|
"js",
|
|||
|
"token",
|
|||
|
"tokenize",
|
|||
|
"regex"
|
|||
|
],
|
|||
|
"license": "MIT",
|
|||
|
"maintainers": [
|
|||
|
{
|
|||
|
"name": "lydell",
|
|||
|
"email": "simon.lydell@gmail.com"
|
|||
|
}
|
|||
|
],
|
|||
|
"name": "js-tokens",
|
|||
|
"optionalDependencies": {},
|
|||
|
"readme": "Overview [![Build Status](https://travis-ci.org/lydell/js-tokens.svg?branch=master)](https://travis-ci.org/lydell/js-tokens)\n========\n\nA regex that tokenizes JavaScript.\n\n```js\nvar jsTokens = require(\"js-tokens\").default\n\nvar jsString = \"var foo=opts.foo;\\n...\"\n\njsString.match(jsTokens)\n// [\"var\", \" \", \"foo\", \"=\", \"opts\", \".\", \"foo\", \";\", \"\\n\", ...]\n```\n\n\nInstallation\n============\n\n`npm install js-tokens`\n\n```js\nimport jsTokens from \"js-tokens\"\n// or:\nvar jsTokens = require(\"js-tokens\").default\n```\n\n\nUsage\n=====\n\n### `jsTokens` ###\n\nA regex with the `g` flag that matches JavaScript tokens.\n\nThe regex _always_ matches, even invalid JavaScript and the empty string.\n\nThe next match is always directly after the previous.\n\n### `var token = matchToToken(match)` ###\n\n```js\nimport {matchToToken} from \"js-tokens\"\n// or:\nvar matchToToken = require(\"js-tokens\").matchToToken\n```\n\nTakes a `match` returned by `jsTokens.exec(string)`, and returns a `{type:\nString, value: String}` object. The following types are available:\n\n- string\n- comment\n- regex\n- number\n- name\n- punctuator\n- whitespace\n- invalid\n\nMulti-line comments and strings also have a `closed` property indicating if the\ntoken was closed or not (see below).\n\nComments and strings both come in several flavors. To distinguish them, check if\nthe token starts with `//`, `/*`, `'`, `\"` or `` ` ``.\n\nNames are ECMAScript IdentifierNames, that is, including both identifiers and\nkeywords. You may use [is-keyword-js] to tell them apart.\n\nWhitespace includes both line terminators and other whitespace.\n\n[is-keyword-js]: https://github.com/crissdev/is-keyword-js\n\n\nECMAScript support\n==================\n\nThe intention is to always support the latest stable ECMAScript version.\n\nIf adding support for a newer version requires changes, a new version with a\nmajor verion bump will be released.\n\nCurrently, [ECMAScript 2017] is supported.\n\n[ECMAScript 2017]: https://www.ecma-international.org/ecma-262/8.0/index.html\n\n\nInvalid code handling\n=====================\n\nUnterminated strings are still matched as strings. JavaScript strings cannot\ncontain (unescaped) newlines, so unterminated strings simply end at the end of\nthe line. Unterminated template strings can contain unescaped newlines, though,\nso they go on to the end of input.\n\nUnterminated multi-line comments are also still matched as comments. They\nsimply go on to the end of the input.\n\nUnterminated regex literals are likely matched as division and whatever is\ninside the regex.\n\nInvalid ASCII characters have their own capturing group.\n\nInvalid non-ASCII characters are treated as names, to simplify the matching of\nnames (except unicode spaces which are treated as whitespace).\n\nRegex literals may contain invalid regex syntax. They are still matched as\nregex literals. They may also contain repeated regex flags, to keep the regex\nsimple.\n\nStrings may contain invalid escape sequences.\n\n\nLimitations\n===========\n\nTokenizing JavaScript using regexes—in fact, _one single regex_—won’t be\nperfect. But that’s not the point either.\n\nYou may compare jsTokens with [esprima] by using `esprima-compare.js`.\nSee `npm run esprima-compare`!\n\n[esprima]: http://esprima.org/\n\n### Template string interpolation ###\n\nTemplate strings are matched as single tokens, from the starting `` ` `` to the\nending `` ` ``, including interpolations (whose tokens are not matched\nindividually).\n\nMatching template string interpolations requires recursive balancing of `{` and\n`}`—something that JavaScript regexes cannot do. Only one level of nesting is\nsupported.\n\n### Division and regex literals collision ###\n\nConsider this example:\n\n```js\nvar g = 9.82\nvar number = bar / 2/g\n\nvar regex = / 2/g\n```\n\nA human can easily understand that in the `number` line we’re dealing with\ndivision, and in the `regex` line we’re dealing with a regex literal. How come?\nBecause humans can look at the whole c
|
|||
|
"readmeFilename": "README.md",
|
|||
|
"repository": {
|
|||
|
"type": "git",
|
|||
|
"url": "git+https://github.com/lydell/js-tokens.git"
|
|||
|
},
|
|||
|
"scripts": {
|
|||
|
"build": "node generate-index.js",
|
|||
|
"dev": "npm run build && npm test",
|
|||
|
"esprima-compare": "node esprima-compare ./index.js everything.js/es5.js",
|
|||
|
"test": "mocha --ui tdd"
|
|||
|
},
|
|||
|
"version": "3.0.2"
|
|||
|
}
|