forked from enviPath/enviPy
Current Dev State
This commit is contained in:
22
static/js/ketcher2/node_modules/has-require/LICENSE
generated
vendored
Normal file
22
static/js/ketcher2/node_modules/has-require/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Ben Drucker
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
82
static/js/ketcher2/node_modules/has-require/README.md
generated
vendored
Normal file
82
static/js/ketcher2/node_modules/has-require/README.md
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
# has-require [](https://travis-ci.org/bendrucker/has-require)
|
||||
|
||||
> Check if code requires any module or a specific id
|
||||
|
||||
## Installing
|
||||
|
||||
```bash
|
||||
$ npm install --save has-require
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var hasRequire = require('has-require')
|
||||
hasRequire('require("foo")', 'foo') // => true
|
||||
hasRequire.any('require') // => false
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
For full implementation details, see the [`Checker`](#checker) API.
|
||||
|
||||
#### `hasRequire(code, id)` -> `boolean`
|
||||
|
||||
##### code
|
||||
|
||||
*Required*
|
||||
Type: `string`
|
||||
|
||||
The code to check.
|
||||
|
||||
##### id
|
||||
|
||||
*Required*
|
||||
Type: `string`
|
||||
|
||||
The module id to check, e.g. `'http'`.
|
||||
|
||||
##### `hasRequire.any(code)` -> `boolean`
|
||||
|
||||
#### code
|
||||
|
||||
*Required*
|
||||
Type: `string`
|
||||
|
||||
The code to check.
|
||||
|
||||
<hr>
|
||||
|
||||
### `Checker`
|
||||
|
||||
#### `new hasRequire.Checker(code)` -> `checker`
|
||||
|
||||
##### code
|
||||
|
||||
*Required*
|
||||
Type: `string`
|
||||
|
||||
The code to store on the checker.
|
||||
|
||||
##### `checker.any()` -> `boolean`
|
||||
|
||||
Checks if any string literal is required. The result is cached. The following code won't be matched:
|
||||
|
||||
* `require`
|
||||
* `require()`
|
||||
* `require('')`
|
||||
|
||||
##### `checker.has(id)` -> `boolean`
|
||||
|
||||
##### id
|
||||
|
||||
*Required*
|
||||
Type: `string`
|
||||
|
||||
The module id to check, e.g. `'http'`.
|
||||
|
||||
Uses `checker.any()` first, so calling `has` for multiple ids when no `require` is present (`!checker.any()`) will avoid needlessly re-testing the code.
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Ben Drucker](http://bendrucker.me)
|
||||
41
static/js/ketcher2/node_modules/has-require/index.js
generated
vendored
Normal file
41
static/js/ketcher2/node_modules/has-require/index.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
'use strict'
|
||||
|
||||
var escape = require('escape-string-regexp')
|
||||
|
||||
module.exports = hasRequire
|
||||
|
||||
function hasRequire (code, id) {
|
||||
return new RequireChecker(code).has(id)
|
||||
}
|
||||
|
||||
hasRequire.any = function anyRequire (code) {
|
||||
return new RequireChecker(code).any()
|
||||
}
|
||||
|
||||
hasRequire.Checker = RequireChecker
|
||||
|
||||
function RequireChecker (code) {
|
||||
this.code = code
|
||||
}
|
||||
|
||||
var anyRegExp = createRegExp('@?[A-Za-z0-9/_.-]+')
|
||||
RequireChecker.prototype.any = function anyRequire () {
|
||||
if (this._any != null) return this._any
|
||||
this._any = anyRegExp.test(this.code)
|
||||
return this._any
|
||||
}
|
||||
|
||||
RequireChecker.prototype.has = function has (id) {
|
||||
if (!id) throw new Error('module id is required')
|
||||
return this.any() && createRegExp(escape(id)).test(this.code)
|
||||
}
|
||||
|
||||
function createRegExp (input) {
|
||||
return new RegExp([
|
||||
escape('require('),
|
||||
'\\s*[\'"]',
|
||||
input,
|
||||
'[\'"]\\s*',
|
||||
escape(')')
|
||||
].join(''))
|
||||
}
|
||||
59
static/js/ketcher2/node_modules/has-require/package.json
generated
vendored
Normal file
59
static/js/ketcher2/node_modules/has-require/package.json
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
{
|
||||
"_from": "has-require@~1.2.1",
|
||||
"_id": "has-require@1.2.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-khZ1qxMNvZdo/I2o8ajiQt+kF3Q=",
|
||||
"_location": "/has-require",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "has-require@~1.2.1",
|
||||
"name": "has-require",
|
||||
"escapedName": "has-require",
|
||||
"rawSpec": "~1.2.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.2.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/replace-requires"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/has-require/-/has-require-1.2.2.tgz",
|
||||
"_shasum": "921675ab130dbd9768fc8da8f1a8e242dfa41774",
|
||||
"_spec": "has-require@~1.2.1",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/replace-requires",
|
||||
"author": {
|
||||
"name": "Ben Drucker",
|
||||
"email": "bvdrucker@gmail.com",
|
||||
"url": "http://bendrucker.me"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/bendrucker/has-require/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "^1.0.3"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Check if code requires any module or a specific id",
|
||||
"devDependencies": {
|
||||
"standard": "^4.0.1",
|
||||
"tape": "^4.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/bendrucker/has-require",
|
||||
"keywords": [
|
||||
"require",
|
||||
"browserify"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "has-require",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/bendrucker/has-require.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tape test.js"
|
||||
},
|
||||
"version": "1.2.2"
|
||||
}
|
||||
31
static/js/ketcher2/node_modules/has-require/test.js
generated
vendored
Normal file
31
static/js/ketcher2/node_modules/has-require/test.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
'use strict'
|
||||
|
||||
var test = require('tape')
|
||||
var hasRequire = require('./')
|
||||
|
||||
test(function (t) {
|
||||
t.throws(hasRequire.bind(null, 'code'), /id is required/)
|
||||
|
||||
t.ok(hasRequire("require('foo')", 'foo'), 'single quotes')
|
||||
t.ok(hasRequire('require("foo")', 'foo'), 'double quotes')
|
||||
t.ok(hasRequire('require( "foo" )', 'foo'), 'whitespace')
|
||||
t.notOk(hasRequire('require("foo")', 'bar'), 'match id')
|
||||
|
||||
t.ok(hasRequire('require("foo/bar")', 'foo/bar'), 'slash')
|
||||
t.ok(hasRequire('require("./foo/bar")', './foo/bar'), 'dot slash')
|
||||
|
||||
t.ok(hasRequire.any('require("foo")'), 'normal')
|
||||
t.ok(hasRequire.any('require("foo-bar")'), 'dash')
|
||||
t.ok(hasRequire.any('require("foo_bar")'), 'underscore')
|
||||
t.ok(hasRequire.any('require("foo2")'), 'number')
|
||||
t.ok(hasRequire.any('require("foo.bar")'), 'dot')
|
||||
t.ok(hasRequire.any('require("@bendrucker/pkg")'), 'scoped')
|
||||
|
||||
t.notOk(hasRequire.any('require'), 'no call')
|
||||
t.notOk(hasRequire.any('require()'), 'empty call')
|
||||
t.notOk(hasRequire.any('require(identifier)'), 'literal')
|
||||
t.notOk(hasRequire.any('require("")'), 'empty string')
|
||||
t.notOk(hasRequire.any('require("bendrucker@pkg")'), 'invalid @ sign')
|
||||
|
||||
t.end()
|
||||
})
|
||||
Reference in New Issue
Block a user