Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriangalliat committed Feb 2, 2015
2 parents 60ef2c9 + 1a235f5 commit 5a12522
Show file tree
Hide file tree
Showing 49 changed files with 163 additions and 157 deletions.
5 changes: 1 addition & 4 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@
"maxlen": false,
"esnext": true,
"node": true,
"mocha": true,
"globals": {
"$traceurRuntime": true
}
"mocha": true
}
10 changes: 1 addition & 9 deletions .jshintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,4 @@ maxlen: false # No maximum line length

esnext: true # ES6
node: true # Node.js

globals: # Global variables
$traceurRuntime: true

# For tests only
before: true
after: true
describe: true
it: true
mocha: true
14 changes: 9 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.2

* Move to 6to5 3 in `selfContained` mode to avoid global scope pollution ([#354](https://github.com/SassDoc/sassdoc/issues/354#issuecomment-72464640))

## 2.0.0 — Shiny Streamy Octopus

### API breaks for users
Expand Down Expand Up @@ -33,11 +37,11 @@
### API breaks for third party integration

* The node API has been revamped and unified.
* `sassdoc.documentize` does not exist anymore.
* `sassdoc(src [, config])` execute the full Documentation process, returns a Promise.
* `sassdoc([config])` execute the full Documentation process, returns a Stream of Vinyl files.
* `sassdoc.parse(src [, config])` returns a Promise with the full data object.
* `sassdoc.parse([config])` returns a Stream with the full data object.
* `sassdoc.documentize` does not exist anymore.
* `sassdoc(src [, config])` execute the full Documentation process, returns a Promise.
* `sassdoc([config])` execute the full Documentation process, returns a Stream of Vinyl files.
* `sassdoc.parse(src [, config])` returns a Promise with the full data object.
* `sassdoc.parse([config])` returns a Stream with the full data object.

### New features

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH := $(PWD)/node_modules/.bin:$(PATH)
SASSDOC := $(PWD)/bin/sassdoc
MOCHA := $(PWD)/node_modules/.bin/_mocha
TO5_FLAGS := --experimental
TO5_FLAGS = --experimental --loose all --optional selfContained

all: dist lint test

Expand All @@ -16,7 +16,7 @@ dist:
# ============

lint: .jshintrc
jshint bin/sassdoc index.js src test
jshint --verbose bin/sassdoc index.js src test

.jshintrc: .jshintrc.yaml
js-yaml $< > $@
Expand Down
2 changes: 0 additions & 2 deletions bin/sassdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

'use strict';

require('../polyfill');

require('../dist/cli')(process.argv.slice(2));
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
'use strict';

require('./polyfill');
var sassdoc = require('./dist/sassdoc');

module.exports = require('./dist/sassdoc');
module.exports = sassdoc.default;
module.exports.parseFilter = sassdoc.parseFilter;
module.exports.ensureEnvironment = sassdoc.ensureEnvironment;
module.exports.parse = sassdoc.parse;
module.exports.Environment = sassdoc.Environment;
module.exports.Logger = sassdoc.Logger;
module.exports.Parser = sassdoc.Parser;
module.exports.sorter = sassdoc.sorter;
module.exports.errors = sassdoc.errors;
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"url": "https://twitter.com/pascalduez"
}
],
"version": "2.0.1",
"version": "2.0.2",
"license": {
"type": "MIT",
"url": "http://opensource.org/licenses/MIT"
Expand Down Expand Up @@ -78,9 +78,9 @@
"README.md"
],
"dependencies": {
"6to5-runtime": "^3.3.3",
"chalk": "^0.5.0",
"concat-stream": "^1.4.7",
"core-js": "^0.4.3",
"docopt": "^0.4.1",
"glob": "^4.3.1",
"glob2base": "0.0.12",
Expand All @@ -90,24 +90,23 @@
"minimatch": "^2.0.0",
"mkdirp": "^0.5.0",
"multipipe": "^0.1.2",
"regenerator": "^0.8.3",
"rimraf": "^2.2.8",
"safe-wipe": "0.*",
"sass-convert": "^0.4.0",
"sassdoc-theme-default": "^2.0.0",
"sass-convert": "^0.4.1",
"sassdoc-theme-default": "^2.0.4",
"scss-comment-parser": "^0.6.0",
"through2": "^0.6.3",
"update-notifier": "^0.3.0",
"vinyl-fs": "^0.3.11",
"vinyl-source-stream": "^1.0.0"
},
"devDependencies": {
"6to5": "^2.9.4",
"6to5": "^3.3.4",
"coveralls": "^2.11.2",
"dateformat": "^1.0.11",
"istanbul": "^0.3.5",
"jsesc": "^0.5.0",
"jshint": "^2.5.10",
"jshint": "^2.6.0",
"mocha": "^2.0.1",
"sinon": "^1.12.2",
"vinyl": "^0.4.6"
Expand Down
2 changes: 0 additions & 2 deletions polyfill.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/annotation/annotations/alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function alias(env) {
let alias = item.alias;
let name = item.context.name;

let aliasedItem = data.find(i => i.context.name === alias);
let aliasedItem = Array.find(data, i => i.context.name === alias);

if (aliasedItem === undefined) {
env.logger.warn(`Item \`${name}\` is an alias of \`${alias}\` but this item doesn't exist.`);
Expand Down
7 changes: 4 additions & 3 deletions src/annotation/annotations/require.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const utils = require('../../utils');
import { splitNamespace } from '../../utils';

const uniq = require('lodash.uniq');

let reqRegEx = /^\s*(?:\{(.*)\})?\s*(?:(\$?[^\s]+))?\s*(?:-?\s*([^<$]*))?\s*(?:<?\s*(.*)\s*>)?$/;
Expand All @@ -15,7 +16,7 @@ export default function (env) {
name: match[2],
};

obj.external = utils.splitNamespace(obj.name).length > 1;
obj.external = splitNamespace(obj.name).length > 1;

if (obj.name.indexOf('$') === 0) {
obj.type = 'variable';
Expand Down Expand Up @@ -126,7 +127,7 @@ export default function (env) {
return req;
}

let reqItem = data.find(x => x.context.name === req.name);
let reqItem = Array.find(data, x => x.context.name === req.name);

if (reqItem === undefined) {
if (!req.autofill) {
Expand Down
2 changes: 1 addition & 1 deletion src/annotation/annotations/see.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function see(env) {
}

item.see = item.see.map(see => {
let seeItem = data.find(x => x.context.name === see.name);
let seeItem = Array.find(data, x => x.context.name === see.name);

if (seeItem !== undefined) {
return seeItem;
Expand Down
2 changes: 1 addition & 1 deletion src/annotation/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const annotations = require('./annotations');
import annotations from './annotations';

export default class AnnotationsApi {
constructor(env) {
Expand Down
13 changes: 8 additions & 5 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ Options:
--debug Output debugging information.
`;

import Environment from './environment';
import Logger from './logger';
// jshint/jshint#2118
// import sassdoc, { parse } from './sassdoc';
import { default as sassdoc, parse } from './sassdoc';
import * as errors from './errors';

const docopt = require('docopt').docopt;
const source = require('vinyl-source-stream');
const pkg = require('../package.json');
const Environment = require('./environment');
const Logger = require('./logger');
const sassdoc = require('./sassdoc');
const errors = require('./errors');

export default function cli(argv = process.argv.slice(2)) {
let options = docopt(doc, { version: pkg.version, argv: argv });
Expand Down Expand Up @@ -72,7 +75,7 @@ export default function cli(argv = process.argv.slice(2)) {
handler = sassdoc;
cb = () => {};
} else {
handler = sassdoc.parse;
handler = parse;
cb = data => console.log(JSON.stringify(data, null, 2));
}

Expand Down
9 changes: 5 additions & 4 deletions src/environment.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { is } from './utils';
import * as errors from './errors';

const EventEmitter = require('events').EventEmitter;
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
const errors = require('./errors');
const utils = require('./utils');
const converter = require('sass-convert');

export default class Environment extends EventEmitter {
Expand All @@ -25,10 +26,10 @@ export default class Environment extends EventEmitter {
converter.VersionError,
];

if (friendlyErrors.find(c => error instanceof c)) {
if (Array.find(friendlyErrors, c => error instanceof c)) {
logger.error(error.message);
} else {
if (utils.is.error(error) && 'stack' in error) {
if (is.error(error) && 'stack' in error) {
logger.error(error.stack);
} else {
logger.error(error);
Expand Down
2 changes: 1 addition & 1 deletion src/exclude.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const minimatch = require('minimatch');
*/
export default function exclude(patterns) {
return through.obj((file, enc, cb) => {
if (patterns.find(x => minimatch(file.relative, x))) {
if (Array.find(patterns, x => minimatch(file.relative, x))) {
return cb();
}

Expand Down
6 changes: 3 additions & 3 deletions src/logger.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const { is } = require('./utils');
const errors = require('./errors');
import { is } from './utils';
import * as errors from './errors';

const fmt = require('util').format;
const chalk = require('chalk');

// Special chars.
const chevron = '\xBB';
const checkmark = '\u2713';
const octopus = '\uD83D\uDC19'; // jshint ignore:line
const green = chalk.green(chevron);
const yellow = chalk.yellow(chevron);
const red = chalk.red(chevron);
Expand Down
12 changes: 8 additions & 4 deletions src/parser.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const AnnotationsApi = require('./annotation');
import { defer } from './utils';
import * as errors from './errors';
import AnnotationsApi from './annotation';
import sorter from './sorter';

const ScssCommentParser = require('scss-comment-parser');
const through = require('through2');
const concat = require('concat-stream');
const path = require('path');
const utils = require('./utils');
const errors = require('./errors');

export default class Parser {
constructor(env, additionalAnnotations) {
Expand All @@ -26,6 +28,8 @@ export default class Parser {
* Called with all found annotations except with type "unkown".
*/
postProcess(data) {
data = sorter(data);

Object.keys(this.annotations.list).forEach(key => {
let annotation = this.annotations.list[key];

Expand All @@ -50,7 +54,7 @@ export default class Parser {
* @return {Object}
*/
stream() {
let deferred = utils.defer();
let deferred = defer();
let data = [];

let transform = (file, enc, cb) => {
Expand Down
2 changes: 1 addition & 1 deletion src/recurse.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { is } = require('./utils');
import { is } from './utils';

const path = require('path');
const through = require('through2');
Expand Down
Loading

0 comments on commit 5a12522

Please sign in to comment.