espower-source
Advanced tools
Comparing version 0.7.3 to 0.8.0
@@ -13,3 +13,3 @@ /** | ||
escodegen = require('escodegen'), | ||
merge = require('lodash.merge'), | ||
extend = require('xtend'), | ||
convert = require('convert-source-map'); | ||
@@ -23,3 +23,3 @@ | ||
jsAst = esprima.parse(jsCode, {tolerant: true, loc: true, tokens: true, raw: true, source: filepath}); | ||
espowerOptions = merge(merge(espower.defaultOptions(), options), { | ||
espowerOptions = extend(espower.defaultOptions(), options, { | ||
destructive: true, | ||
@@ -26,0 +26,0 @@ path: filepath |
{ | ||
"name": "espower-source", | ||
"version": "0.7.3", | ||
"version": "0.8.0", | ||
"description": "Power Assert instrumentor from source to source, with source-map", | ||
@@ -26,2 +26,11 @@ "keywords": [ | ||
"main": "./index.js", | ||
"files": [ | ||
"CHANGELOG.md", | ||
"MIT-LICENSE.txt", | ||
"README.md", | ||
"gulpfile.js", | ||
"index.js", | ||
"package.json", | ||
"test" | ||
], | ||
"repository": { | ||
@@ -32,19 +41,30 @@ "type": "git", | ||
"scripts": { | ||
"bundle": "./node_modules/.bin/browserify index.js --standalone espowerSource > ./build/espower-source.js", | ||
"jshint": "./node_modules/.bin/jshint index.js", | ||
"test": "./node_modules/.bin/mocha" | ||
"bower": "bower install --config.interactive=false", | ||
"build": "gulp bundle", | ||
"lint": "gulp lint", | ||
"test": "gulp test" | ||
}, | ||
"dependencies": { | ||
"espower": "~0.7.0", | ||
"esprima": "~1.2.1", | ||
"escodegen": "~1.3.2", | ||
"convert-source-map": "~0.3.3", | ||
"lodash.merge": "~2.4.1" | ||
"convert-source-map": "~0.4.0", | ||
"escodegen": "~1.3.3", | ||
"espower": "~0.8.0", | ||
"esprima": "~1.2.2", | ||
"xtend": "~4.0.0" | ||
}, | ||
"devDependencies": { | ||
"browserify": "~4.1.6", | ||
"jshint": "~2.5.1", | ||
"mocha": "~1.20.0", | ||
"semver": "~2.3.0", | ||
"source-map": "~0.1.33" | ||
"brfs": "~1.2.0", | ||
"browserify": "~5.9.1", | ||
"del": "~0.1.1", | ||
"glob": "~4.0.5", | ||
"gulp": "~3.8.7", | ||
"gulp-derequire": "~0.3.1", | ||
"gulp-jshint": "~1.8.4", | ||
"gulp-mocha": "~0.5.2", | ||
"gulp-mocha-phantomjs": "~0.3.0", | ||
"gulp-util": "~3.0.0", | ||
"gulp-webserver": "~0.6.0", | ||
"jshint-stylish": "~0.4.0", | ||
"mocha": "~1.21.3", | ||
"source-map": "~0.1.38", | ||
"vinyl-source-stream": "~0.1.1" | ||
}, | ||
@@ -51,0 +71,0 @@ "engines": { |
@@ -8,3 +8,3 @@ espower-source | ||
Power Assert instrumentor from source to source, with source-map. | ||
Power Assert instrumentor from code to code, with SourceMap. | ||
@@ -14,5 +14,5 @@ | ||
--------------------------------------- | ||
`espower-source` is a source code transformer that applies [espower](http://github.com/twada/espower) to target source. | ||
`espower-source` is a source code transformer that applies [espower](http://github.com/twada/espower) to target code. | ||
`espower` manipulates assertion expression (JavaScript Code) represented as [Mozilla JavaScript AST](https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API), to instrument power-assert feature into the code. | ||
`espower` manipulates assertion expression (JavaScript Code) represented as [Mozilla JavaScript AST](https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API), to instrument power-assert feature into the code. SourceMap information is appended in SourceMap Comment syntax at the end of returned code. | ||
@@ -24,2 +24,43 @@ Please note that `espower-source` is a beta version product. Pull-requests, issue reports and patches are always welcomed. | ||
CHANGELOG | ||
--------------------------------------- | ||
See [CHANGELOG](https://github.com/twada/espower-source/blob/master/CHANGELOG.md) | ||
API | ||
--------------------------------------- | ||
### var modifiedCode = espowerSource(originalCode, filepath, [options]) | ||
| return type | | ||
|:------------| | ||
| `string` | | ||
`espowerSource` function manipulates `originalCode` then returns (transformed) JavaScript code as string. SourceMap information is appended in SourceMap Comment syntax at the end of returned code. | ||
#### originalCode | ||
| type | default value | | ||
|:---------|:--------------| | ||
| `string` | N/A | | ||
Original JavaScript source code that is a source of code transformation. | ||
#### filepath | ||
| type | default value | | ||
|:---------|:--------------| | ||
| `string` | N/A | | ||
Filepath of `originalCode`. If passed, espowerSource stores filepath information for later reporting. | ||
#### options | ||
| type | default value | | ||
|:---------|:--------------| | ||
| `object` | (return value of `espower.defaultOptions()` but with `destructive` option is `true`) | | ||
Configuration options for `espower` module. If not passed, default options (Same as [espower.defaultOptions()](https://github.com/twada/espower#var-options--espowerdefaultoptions)) will be used, but `destructive` option is set to `true` by espower-source module. | ||
AUTHOR | ||
@@ -26,0 +67,0 @@ --------------------------------------- |
@@ -1,6 +0,6 @@ | ||
var espowerSource = require('..'), | ||
sourceMap = require('source-map'), | ||
convert = require('convert-source-map'), | ||
fs = require('fs'), | ||
assert = require('assert'); | ||
var espowerSource = require('..'); | ||
var sourceMap = require('source-map'); | ||
var convert = require('convert-source-map'); | ||
var fs = require('fs'); | ||
var assert = require('assert'); | ||
@@ -10,3 +10,3 @@ describe('with default options', function() { | ||
this.path = 'test/fixtures/example.js'; | ||
this.input = fs.readFileSync(this.path, 'utf8'), | ||
this.input = fs.readFileSync('test/fixtures/example.js', 'utf8'), | ||
this.output = espowerSource(this.input, this.path); | ||
@@ -68,13 +68,9 @@ this.map = convert.fromSource(this.output).toObject(); | ||
this.path = 'test/fixtures/customized.js'; | ||
this.input = fs.readFileSync(this.path, 'utf8'), | ||
this.input = fs.readFileSync('test/fixtures/customized.js', 'utf8'), | ||
this.output = espowerSource(this.input, this.path, { | ||
powerAssertVariableName: 'refute', | ||
targetMethods: { | ||
oneArg: [ | ||
'isNull' | ||
], | ||
twoArgs: [ | ||
'same' | ||
] | ||
} | ||
patterns: [ | ||
'refute(actual, [message])', | ||
'refute.same(actual, expected, [message])', | ||
'refute.isNull(object, [message])' | ||
] | ||
}); | ||
@@ -81,0 +77,0 @@ this.map = convert.fromSource(this.output).toObject(); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
High entropy strings
Supply chain riskContains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
76
1
25061
15
12
330
+ Addedxtend@~4.0.0
+ Addedarray-buffer-byte-length@1.0.2(transitive)
+ Addedarraybuffer.prototype.slice@1.0.4(transitive)
+ Addedasync-function@1.0.0(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addedconvert-source-map@0.4.1(transitive)
+ Addeddata-view-buffer@1.0.2(transitive)
+ Addeddata-view-byte-length@1.0.2(transitive)
+ Addeddata-view-byte-offset@1.0.1(transitive)
+ Addeddeep-equal@0.2.2(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-abstract@1.23.9(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedes-set-tostringtag@2.1.0(transitive)
+ Addedes-to-primitive@1.3.0(transitive)
+ Addedescallmatch@0.3.1(transitive)
+ Addedespower@0.8.0(transitive)
+ Addedespurify@0.1.3(transitive)
+ Addedfor-each@0.3.4(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.8(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedget-symbol-description@1.1.0(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-bigints@1.1.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.2.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.1.0(transitive)
+ Addedis-array-buffer@3.0.5(transitive)
+ Addedis-async-function@2.1.1(transitive)
+ Addedis-bigint@1.1.0(transitive)
+ Addedis-boolean-object@1.2.1(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-data-view@1.0.2(transitive)
+ Addedis-date-object@1.1.0(transitive)
+ Addedis-finalizationregistry@1.1.1(transitive)
+ Addedis-generator-function@1.1.0(transitive)
+ Addedis-map@2.0.3(transitive)
+ Addedis-number-object@1.1.1(transitive)
+ Addedis-regex@1.2.1(transitive)
+ Addedis-set@2.0.3(transitive)
+ Addedis-shared-array-buffer@1.0.4(transitive)
+ Addedis-string@1.1.1(transitive)
+ Addedis-symbol@1.1.1(transitive)
+ Addedis-typed-array@1.1.15(transitive)
+ Addedis-weakmap@2.0.2(transitive)
+ Addedis-weakref@1.1.0(transitive)
+ Addedis-weakset@2.0.4(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.7(transitive)
+ Addedown-keys@1.0.1(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedreflect.getprototypeof@1.0.10(transitive)
+ Addedregexp.prototype.flags@1.5.4(transitive)
+ Addedsafe-array-concat@1.1.3(transitive)
+ Addedsafe-push-apply@1.0.0(transitive)
+ Addedsafe-regex-test@1.1.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedset-proto@1.0.0(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedstring.prototype.trim@1.2.10(transitive)
+ Addedstring.prototype.trimend@1.0.9(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedtraverse@0.6.11(transitive)
+ Addedtype-name@1.0.1(transitive)
+ Addedtyped-array-buffer@1.0.3(transitive)
+ Addedtyped-array-byte-length@1.0.3(transitive)
+ Addedtyped-array-byte-offset@1.0.4(transitive)
+ Addedtyped-array-length@1.0.7(transitive)
+ Addedtypedarray.prototype.slice@1.0.5(transitive)
+ Addedunbox-primitive@1.1.0(transitive)
+ Addedwhich-boxed-primitive@1.1.1(transitive)
+ Addedwhich-builtin-type@1.2.1(transitive)
+ Addedwhich-collection@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.18(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedlodash.merge@~2.4.1
- Removedconvert-source-map@0.3.5(transitive)
- Removedespower@0.7.0(transitive)
- Removedlodash._arraypool@2.4.1(transitive)
- Removedlodash._basebind@2.4.1(transitive)
- Removedlodash._basecreate@2.4.1(transitive)
- Removedlodash._basecreatecallback@2.4.1(transitive)
- Removedlodash._basecreatewrapper@2.4.1(transitive)
- Removedlodash._basemerge@2.4.1(transitive)
- Removedlodash._createwrapper@2.4.1(transitive)
- Removedlodash._getarray@2.4.1(transitive)
- Removedlodash._isnative@2.4.1(transitive)
- Removedlodash._maxpoolsize@2.4.1(transitive)
- Removedlodash._objecttypes@2.4.1(transitive)
- Removedlodash._releasearray@2.4.1(transitive)
- Removedlodash._setbinddata@2.4.1(transitive)
- Removedlodash._shimisplainobject@2.4.1(transitive)
- Removedlodash._shimkeys@2.4.1(transitive)
- Removedlodash._slice@2.4.1(transitive)
- Removedlodash.bind@2.4.1(transitive)
- Removedlodash.foreach@2.4.1(transitive)
- Removedlodash.forin@2.4.1(transitive)
- Removedlodash.forown@2.4.1(transitive)
- Removedlodash.identity@2.4.1(transitive)
- Removedlodash.isarray@2.4.1(transitive)
- Removedlodash.isfunction@2.4.1(transitive)
- Removedlodash.isobject@2.4.1(transitive)
- Removedlodash.isplainobject@2.4.1(transitive)
- Removedlodash.keys@2.4.1(transitive)
- Removedlodash.merge@2.4.1(transitive)
- Removedlodash.noop@2.4.1(transitive)
- Removedlodash.support@2.4.1(transitive)
Updatedconvert-source-map@~0.4.0
Updatedescodegen@~1.3.3
Updatedespower@~0.8.0
Updatedesprima@~1.2.2