Skip to content

Commit

Permalink
Update deps (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
gucong3000 committed Nov 28, 2018
1 parent 9f313a5 commit b9ce81e
Show file tree
Hide file tree
Showing 12 changed files with 184 additions and 133 deletions.
13 changes: 8 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = tab
indent_size = 2
tab_width = 4
insert_final_newline = true
trim_trailing_whitespace = true
block_comment_start = /*
block_comment = *
block_comment_end = */

[*.{cmd,bat}]
end_of_line = crlf

[{package.json,.travis.yml,appveyor.yml}]
[{package.json,*.yml,*.md}]
indent_style = space
indent_size = 2

2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

81 changes: 36 additions & 45 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
{
"parserOptions": {
"sourceType": "script",
"impliedStrict": false
},
"env": {
"browser": false,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended"
"standard"
],
"root": true,
"rules": {
"arrow-spacing": [
"comma-dangle": [
"error",
{
"after": true,
"before": true
}
],
"comma-spacing": [
"error",
{
"after": true,
"before": false
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "never"
}
],
"indent": [
Expand All @@ -30,25 +29,21 @@
"SwitchCase": 1
}
],
"keyword-spacing": [
"error",
{
"after": true,
"before": true
}
"no-tabs": [
"off"
],
"no-console": [
"off",
{
}
"no-var": [
"error"
],
"prefer-arrow-callback": [
"error"
],
"prefer-const": [
"error"
],
"quotes": [
"error",
"single",
{
"allowTemplateLiterals": true,
"avoidEscape": true
}
"double"
],
"semi": [
"error",
Expand All @@ -57,26 +52,22 @@
"omitLastInOneLineBlock": false
}
],
"space-before-blocks": [
"error",
"always"
],
"space-infix-ops": [
"error"
],
"spaced-comment": [
"error",
"always"
],
"strict": [
"error",
"safe"
],
"valid-jsdoc": [
"warn",
{
"requireReturn": false
}
]
}
},
"overrides": [
{
"files": [
"test/**/*"
],
"env": {
"mocha": true
},
"rules": {
"no-template-curly-in-string": "off"
}
}
]
}
33 changes: 31 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# Created by https://www.gitignore.io/api/node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
Expand All @@ -20,18 +26,41 @@ coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env


# End of https://www.gitignore.io/api/node

lib
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
*.log
*.pid
*.seed
*.tgz
.circleci
.editorconfig
.babelrc
.eslintrc*
.eslintignore
.gitignore
.grunt
.lock-wscript
.node_repl_history
.nyc_output
.stylelintrc*
.travis.yml
.vscode
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ node_js:
- "stable"
- "6"
after_success:
- "npm run coveralls"
- npm run report-coverage
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ npm i gulp-jscc --save

```js
gulp.src('test/fixtures/example.js')
.pipe(jscc(options))
.pipe(gulp.dest('dist'));
.pipe(jscc(options))
.pipe(gulp.dest('dist'));
```

## Documentation
Expand All @@ -30,4 +30,3 @@ You can read in the Wiki about:
- [Basic Syntax](https://github.com/aMarCruz/jscc/wiki/Syntax)
- [Keywords](https://github.com/aMarCruz/jscc/wiki/Keywords)
- [Examples & Tricks](https://github.com/aMarCruz/jscc/wiki/Examples)

26 changes: 16 additions & 10 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
version: "{build}"
skip_branch_with_pr: true
skip_tags: true
build: off

# Test against this version of Node.js
environment:
matrix:
# node.js
- nodejs_version: "stable"
- nodejs_version: "6"
- nodejs_version: stable

platform:
- x64

# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install Node.js
- ps: Install-Product node $env:nodejs_version $env:platform
# install modules
- npm install

# Post-install test scripts.
# to run your custom scripts instead of automatic tests
test_script:
# run tests
- "npm run test-cov"
- npm test

# Don't actually build.
build: off
# to run your custom scripts instead of provider deployments
after_test:
- npm run report-coverage
30 changes: 15 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
'use strict';
const Transform = require('stream').Transform;
const PluginError = require('gulp-util').PluginError;
const BufferStreams = require('bufferstreams');
var applySourceMap = require('vinyl-sourcemaps-apply');
const jscc = require('jscc');
"use strict";
const Transform = require("stream").Transform;
const PluginError = require("plugin-error");
const BufferStreams = require("bufferstreams");
const applySourceMap = require("vinyl-sourcemaps-apply");
const jscc = require("jscc");

function transformBuffer(buffer, file, options) {
function transformBuffer (buffer, file, options) {
options = Object.assign({}, options, {
sourceMap: Boolean(file.sourceMap),
});
let result = jscc(buffer.toString(), file.path, options);
const result = jscc(buffer.toString(), file.path, options);
if (result && result.code) {
buffer = new Buffer(result.code);
buffer = Buffer.from(result.code);
if (file.sourceMap && result.map) {
result.map.file = file.relative;
applySourceMap(file, result.map);
Expand All @@ -20,26 +20,26 @@ function transformBuffer(buffer, file, options) {
return buffer;
}

module.exports = function(options) {
module.exports = function (options) {
options = Object.assign({
prefixes: ['//', '// ', '/*', '/* ', '<!--', '<!-- ']
prefixes: ["//", "// ", "/*", "/* ", "<!--", "<!-- "],
}, options);

function transform(file, encoding, done) {
function transform (file, encoding, done) {
if (file.isBuffer()) {
try {
file.contents = transformBuffer(file.contents, file, options);
} catch (ex) {
done(new PluginError('gulp-jscc', ex));
done(new PluginError("gulp-jscc", ex));
return;
}
} else if (file.isStream()) {
file.contents = file.contents.pipe(new BufferStreams(function(err, buf, cb) {
file.contents = file.contents.pipe(new BufferStreams((err, buf, cb) => {
if (buf) {
try {
buf = transformBuffer(buf, file, options);
} catch (ex) {
err = new PluginError('gulp-jscc', ex);
err = new PluginError("gulp-jscc", ex);
}
}
cb(err, buf);
Expand Down

0 comments on commit b9ce81e

Please sign in to comment.