Merge commit '8d2f72a55b3bcee6ebcd9cade7e567cdce6338cf' into releases

This commit is contained in:
RedocBot 2016-08-30 17:25:51 +00:00 committed by travis@localhost
commit 868f8ec042
107 changed files with 1395 additions and 5516 deletions

10
.gitignore vendored
View File

@ -20,11 +20,17 @@ npm-debug.log*
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules
#jspm
jspm_packages
# compiled css
lib/**/*.css
# files produced by ngc
lib/**/*.ngfactory.ts
lib/**/*.css.shim.ts
# other
/dist
/demo/build
.tmp
/coverage
.ghpages-tmp
stats.json

View File

@ -25,12 +25,12 @@ addons:
cache:
directories:
- node_modules
- jspm_packages
before_install:
- travis_retry npm install jspm
- jspm config registries.github.auth $JSPM_GITHUB_AUTH_TOKEN
before_install: if [[ `npm -v` != 3* ]]; then npm i -g npm@3; fi
before_script:
- npm run jspm-install
- npm run e2e-server > /dev/null & # kill e2e server
- sleep 3 # give server time to start
after_script:
- kill %1 # kill e2e server
before_deploy:
- npm run build-dist
deploy:

View File

@ -1,3 +1,13 @@
# 1.1.2 (2016-08-21)
### Bug fixes
* Revert "Fix markdown newlines to be GFM" (#82)
* Move license and contact info above description
# 1.1.1 (2016-08-21)
### Bug fixes
* Fix markdown newlines to be GFM (#82)
* Fix markdown code blocks in api description
# 1.1.0 (2016-08-12)
### Bug fixes

View File

@ -122,14 +122,17 @@ Redoc.init('http://petstore.swagger.io/v2/swagger.json', {
```
-----------
## Running locally
## Development
#### Running local dev-server
1. Clone repository
`git clone https://github.com/Rebilly/ReDoc.git`
2. Go to the project folder
`cd ReDoc`
3. Install node modules and front-end dependencies
`npm install`
`npm run jspm-install`
```
npm install
npm run jspm-install
```
4. _(optional)_ Replace `demo/swagger.json` with your own schema
5. Start the server
`npm start`

9
build/helpers.js Normal file
View File

@ -0,0 +1,9 @@
const path = require('path');
function root(args) {
args = Array.prototype.slice.call(arguments, 0);
return path.join.apply(path, [__dirname, '..'].concat(args));
}
module.exports = {
root: root
}

View File

@ -1,15 +1,9 @@
var path = require('path');
var paths = {
source: 'lib/**/*.ts',
html: 'lib/**/*.html',
scss: 'lib/**/*.scss',
sourceEntryPoint: 'lib/index.js',
outputName: 'redoc',
outputName: 'redoc.min.js',
output: 'dist/',
tmp: '.tmp/',
demo: 'demo/**/*',
tests: '{lib,tests}/**/*.spec.ts',
releases: 'demo/releases/'
}

View File

@ -11,6 +11,7 @@ set('-v');
// build
exec('npm run build-dist');
cd('demo');
mv('index-gh.html', 'index.html');
mkdir('-p', 'dist');
cp('-R', '../dist/*', './dist/');
cd('..');
@ -18,7 +19,10 @@ cd('..');
var version = 'v' + require(path.join(__dirname, '../package.json')).version + '/';
var versionDir = path.join(paths.releases, version);
var latestDir = path.join(paths.releases, 'latest/');
var v1Dir = path.join(paths.releases, '1.x.x/');
mkdir('-p', versionDir)
mkdir('-p', latestDir);
cp(paths.redocBuilt + '.min.js', versionDir);
cp(paths.redocBuilt + '.min.js', latestDir);
mkdir('-p', v1Dir);
cp(paths.redocBuilt, versionDir);
cp(paths.redocBuilt, latestDir);
cp(paths.redocBuilt, v1Dir);

View File

@ -1,164 +0,0 @@
var gulp = require('gulp');
var runSequence = require('run-sequence');
var Builder = require('systemjs-builder');
var inlineNg2Template = require('gulp-inline-ng2-template');
var path = require('path');
var sourcemaps = require('gulp-sourcemaps');
var paths = require('../paths');
var fs= require('fs');
var concat = require('gulp-concat');
var gulp = require('gulp');
var sass = require('gulp-sass');
var replace = require('gulp-replace');
var rename = require('gulp-rename');
var argv = require('yargs').argv;
var gulpIf = require('gulp-if');
var sassCopm = require('node-sass');
var ts = require('typescript');
gulp.task('build', function (callback) {
if (argv.skipRebuild) {
console.log('>>> Rebuild skipped')
return callback();
}
return runSequence(
'clean',
'transpile',
'bundle',
'concatDeps',
'copyDebug',
callback
);
});
gulp.task('transpile', function(cb) {
return runSequence(
'tsc',
'inlineTemplates',
cb
);
});
gulp.task('copyDebug', () => {
if (!argv.prod) {
// copy for be accessible from demo for debug
cp(paths.redocBuilt + '.js', paths.redocBuilt + '.min.js');
}
});
gulp.task('tsc', function() {
exec('tsc -p ./tsconfig.json');
});
gulp.task('inlineTemplates', ['sass'], function() {
return gulp.src('.tmp/**/*.js', { base: './tmp' })
.pipe(replace(/'(.*?)\.css'/g, '\'$1.scss\''))
.pipe(inlineNg2Template({
base: './',
useRelativePaths: true,
styleProcessor: compileSass,
customFilePath: function(ext, file) {
var cwd = process.cwd();
var relative = path.relative(cwd, file);
relative = relative.substring('5');
return path.join(cwd, relative);
}
}))
.pipe(gulp.dest(paths.tmp));
});
function compileSass(ext, file, cb) {
file = file.replace('../../shared/styles/variables', 'lib/shared/styles/variables');
file = file.replace('json-schema-common', 'lib/components/JsonSchema/json-schema-common');
file = file.replace('../../shared/styles/share-link', 'lib/shared/styles/share-link');
file = file.replace('../JsonSchema/lib/components/JsonSchema/json-schema-common', 'lib/components/JsonSchema/json-schema-common');
file = file.replace('../../styles/variables', 'lib/shared/styles/variables');
cb(null, sassCopm.renderSync({data: file}).css);
}
var JS_DEPS = argv.prod ? [
'lib/utils/browser-update.js',
'node_modules/zone.js/dist/zone.min.js',
'node_modules/reflect-metadata/Reflect.js',
'node_modules/babel-polyfill/dist/polyfill.min.js'
]: [
'lib/utils/browser-update.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/zone.js/dist/long-stack-trace-zone.js',
'node_modules/reflect-metadata/Reflect.js',
'node_modules/babel-polyfill/dist/polyfill.js'
];
var outputFileName = paths.redocBuilt + (argv.prod ? '.min.js' : '.js');
gulp.task('sass', function () {
return gulp.src(paths.scss, { base: './' })
.pipe(sass.sync({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(gulp.dest(paths.tmp));
});
// concatenate angular2 deps
gulp.task('concatDeps', ['concatPrism'], function() {
return gulp.src(JS_DEPS.concat([path.join(paths.tmp, 'prismjs-bundle.js'), outputFileName]))
.pipe(gulpIf(!argv.prod, sourcemaps.init({loadMaps: true})))
.pipe(concat(outputFileName))
.pipe(gulpIf(!argv.prod, sourcemaps.write('.')))
.pipe(gulp.dest('.'))
});
gulp.task('bundle', ['injectVersionFile'], function bundle(done) {
mkdir('-p', 'dist');
cp('lib/index.js', path.join(paths.tmp, paths.sourceEntryPoint));
var builder = new Builder('./', 'system.config.js');
builder
.buildStatic(path.join(paths.tmp, paths.sourceEntryPoint),
outputFileName,
{ format:'umd', sourceMaps: !argv.prod, lowResSourceMaps: true, minify: argv.prod }
)
.then(() => {
// wait some time to allow flush
setTimeout(() => done(), 500);
})
.catch(err => done(err));
});
gulp.task('concatPrism', function() {
require('../../system.config.js');
var prismFolder = System.normalizeSync('prismjs').substring(8);
prismFolder = prismFolder.substring(0, prismFolder.length -3);
var prismFiles = [
'prism.js',
'components/prism-actionscript.js',
'components/prism-c.js',
'components/prism-cpp.js',
'components/prism-csharp.js',
'components/prism-php.js',
'components/prism-coffeescript.js',
'components/prism-go.js',
'components/prism-haskell.js',
'components/prism-java.js',
'components/prism-lua.js',
'components/prism-matlab.js',
'components/prism-perl.js',
'components/prism-python.js',
'components/prism-r.js',
'components/prism-ruby.js',
'components/prism-bash.js',
'components/prism-swift.js',
'components/prism-objectivec.js',
'components/prism-scala.js'
].map(file => path.join(prismFolder, file));
return gulp.src(prismFiles)
.pipe(concat(path.join(paths.tmp, 'prismjs-bundle.js')))
.pipe(gulp.dest('.'));
});
// needs inlineTemplates run before to create .tmp/lib folder
gulp.task('injectVersionFile', function() {
var version = require('../../package.json').version;
var exportStatement = `export var redocVersion = "${version}"`;
fs.writeFileSync(path.join(paths.tmp, 'lib/version.js'), exportStatement);
})

View File

@ -1,9 +0,0 @@
var gulp = require('gulp');
var paths = require('../paths');
var del = require('del');
var vinylPaths = require('vinyl-paths');
gulp.task('clean', function () {
return gulp.src([paths.output, paths.tmp])
.pipe(vinylPaths(del));
});

View File

@ -1,34 +0,0 @@
var gulp = require('gulp');
var gp = require('gulp-protractor');
var browserSync = require('browser-sync').create('bs-e2e');
gulp.task('test-server', function (done) {
browserSync.init({
open: false,
notify: false,
port: 3000,
ghostMode: false,
server: {
baseDir: './tests/e2e',
routes: {
'/dist': './dist',
'/swagger.yml': './demo/swagger.yml'
},
}
}, done);
});
gulp.task('e2e', ['build', 'test-server'], function(done) {
gulp.src(['tests/e2e/**/*.js'], { read:false })
.pipe(gp.protractor({
configFile: './protractor.conf.js'
})).on('error', function(e) {
browserSync.exit();
throw e;
done();
}).on('end', function() {
browserSync.exit();
done();
});
});

View File

@ -1,15 +0,0 @@
var gulp = require('gulp');
var tslint = require('gulp-tslint');
var paths = require('../paths');
gulp.task('lint', function () {
return gulp.src([paths.source, paths.tests])
.pipe(tslint({
rulesDirectory: 'node_modules/codelyzer'
}))
.pipe(tslint.report(require('tslint-stylish'), {
emitError: true,
sort: true,
bell: true
}));
});

View File

@ -1,17 +0,0 @@
var gulp = require('gulp');
var browserSync = require('browser-sync').create('bs');
gulp.task('serve', ['watch'], function (done) {
browserSync.init({
open: false,
notify: false,
port: 9000,
server: {
baseDir: './demo',
routes: {
'/dist': './dist'
},
},
reloadDelay: 500
}, done);
});

View File

@ -1,52 +0,0 @@
var gulp = require('gulp');
var runSequence = require('run-sequence');
var Server = require('karma').Server;
var remapIstanbul = require('remap-istanbul/lib/gulpRemapIstanbul');
gulp.task('prepare-test', function(cb) {
return runSequence(
'clean',
'transpile',
'concatPrism',
'injectVersionFile',
cb
);
})
/**
* Run test once and exit
*/
gulp.task('test', ['prepare-test'], function (done) {
new Server({
configFile: __dirname + '/../../karma.conf.js',
singleRun: true
}, karmaDone).start();
function karmaDone (exitCode) {
remapCoverage(done, exitCode);
}
});
function remapCoverage(done, statusCode) {
console.log('Remapping coverage to TypeScript format...');
gulp.src('coverage/**/coverage-final.json')
.pipe(remapIstanbul({
reports: {
'lcovonly': 'coverage/lcov.info',
'text-summary': 'coverage/text-summary.txt',
'html': 'coverage'
}
}))
.on('finish', function () {
console.log('Remapping done!');
console.log(cat('coverage/text-summary.txt').stdout);
console.log('Test Done with exit code: ' + statusCode);
if (process.env.TRAVIS) {
console.log('uploading to coveralls')
var out = cat('coverage/lcov.info').exec('coveralls');
if (out.code !== 0) {
console.warn('Failed upload to coveralls');
}
}
done(statusCode);
});
};

View File

@ -1,14 +0,0 @@
var gulp = require('gulp');
var paths = require('../paths');
var browserSync = require('browser-sync').get('bs');
function changed(event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
}
gulp.task('watch', ['build'], function () {
gulp.watch([ paths.source ], [ 'build', browserSync.reload ]).on('change', changed);
gulp.watch([ paths.html ], [ 'build', browserSync.reload]).on('change', changed);
gulp.watch([ paths.scss ], [ 'build', browserSync.reload]).on('change', changed);
gulp.watch([ paths.demo ], [ '', browserSync.reload ]).on('change', changed);
});

98
build/webpack.dev.js Normal file
View File

@ -0,0 +1,98 @@
const webpack = require('webpack');
const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;
const root = require('./helpers').root;
const VERSION = JSON.stringify(require('../package.json').version);
const IS_PRODUCTION = process.env.NODE_ENV === "production";
// TODO Refactor common parts of config
module.exports = {
context: root(),
devtool: 'source-map',
debug: false,
resolve: {
extensions: ['', '.ts', '.js', '.json', '.css', '.scss', '.html'],
root: root('lib'),
descriptionFiles: ['package.json'],
modules: [
'node_modules',
root('lib')
],
alias: {
'./lib/bootstrap': root('lib/bootstrap.dev'),
http: 'stream-http',
https: 'stream-http'
}
},
externals: {
"jquery": "jQuery"
},
node: {
fs: "empty"
},
entry: {
'redoc': './lib/index.ts',
'vendor': './lib/vendor.ts',
'polyfills': './lib/polyfills.ts'
},
devServer: {
outputPath: root('dist'),
watchOptions: {
poll: true
},
port: 9000,
hot: false,
stats: 'errors-only'
},
output: {
path: root('dist'),
filename: '[name].js',
sourceMapFilename: '[name].[id].map',
chunkFilename: '[id].chunk.js'
},
module: {
preLoaders: [{
test: /\.js$/,
loader: 'source-map'
}],
loaders: [{
test: /\.ts$/,
loaders: [
'awesome-typescript-loader',
'angular2-template-loader'
],
exclude: [/\.(spec|e2e)\.ts$/]
},{
test: /lib\/.*\.css$/,
loaders: ['raw-loader'],
exclude: [/redoc-initial-styles\.css$/]
},{
test: /\.css$/,
loaders: ['style', 'css?-import'],
exclude: [/lib\/(?!.*redoc-initial-styles).*\.css$/]
},{
test: /\.html$/,
loader: 'raw-loader'
}]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: ['vendor', 'polyfills'],
minChunks: Infinity
}),
new webpack.DefinePlugin({
'IS_PRODUCTION': IS_PRODUCTION,
'LIB_VERSION': VERSION
}),
new ForkCheckerPlugin()
],
}

86
build/webpack.prod.js Normal file
View File

@ -0,0 +1,86 @@
const webpack = require('webpack');
const VERSION = JSON.stringify(require('../package.json').version);
const root = require('./helpers').root;
const CopyWebpackPlugin = require('copy-webpack-plugin');
const BANNER =
`ReDoc - OpenAPI/Swagger-generated API Reference Documentation
-------------------------------------------------------------
Version: ${VERSION}
Repo: https://github.com/Rebilly/ReDoc`;
module.exports = {
context: root(),
devtool: 'cheap-module-source-map',
resolve: {
extensions: ['', '.ts', '.js', '.json', '.css', '.scss', '.html'],
root: root('lib'),
descriptionFiles: ['package.json'],
modules: [
'node_modules',
root('lib')
],
alias: {
http: 'stream-http',
https: 'stream-http'
}
},
externals: {
"jquery": "jQuery"
},
node: {
fs: "empty"
},
entry: {
'redoc': ['./lib/polyfills.ts', './lib/vendor.ts', './lib/index.ts']
},
output: {
path: root('dist'),
filename: '[name].min.js',
sourceMapFilename: '[name].min.map',
library: 'Redoc',
libraryTarget: 'umd',
umdNamedDefine: true
},
module: {
preLoaders: [{
test: /\.js$/,
loader: 'source-map'
}],
loaders: [{
test: /\.ts$/,
loader: 'awesome-typescript-loader',
exclude: /(node_modules)/
}, {
test: /\.css$/,
loaders: ['style', 'css?-import']
}]
},
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
screw_ie8: true
},
mangle: { screw_ie8 : true },
output: {
comments: false
},
sourceMap: true
}),
new webpack.BannerPlugin(BANNER),
new webpack.DefinePlugin({
'IS_PRODUCTION': true,
'LIB_VERSION': VERSION
})
],
}

106
build/webpack.test.js Normal file
View File

@ -0,0 +1,106 @@
const webpack = require('webpack');
const root = require('./helpers').root;
const VERSION = JSON.stringify(require('../package.json').version);
module.exports = {
devtool: 'inline-source-map',
resolve: {
extensions: ['', '.ts', '.js', '.json', '.css', '.scss', '.html'],
root: root('lib'),
descriptionFiles: ['package.json'],
modules: [
'node_modules',
root('lib'),
],
alias: {
'./lib/bootstrap': root('lib/bootstrap.dev'),
http: 'stream-http',
https: 'stream-http'
}
},
externals: {
"jquery": "jQuery"
},
node: {
fs: "empty"
},
output: {
path: root('dist'),
filename: '[name].js',
sourceMapFilename: '[name].map',
chunkFilename: '[id].chunk.js'
},
module: {
preLoaders: [{
test: /\.js$/,
loader: 'source-map'
}],
loaders: [ {
test: /\.ts$/,
loaders: [
'awesome-typescript-loader'
],
query: {
"sourceMap": false,
"inlineSourceMap": true,
"removeComments": true,
"module": "commonjs"
}
}, {
test: /\.ts$/,
loaders: [
'angular2-template-loader'
],
exclude: [/\.(spec|e2e)\.ts$/]
},{
test: /lib\/.*\.css$/,
loaders: ['raw-loader'],
exclude: [/redoc-initial-styles\.css$/]
},{
test: /\.css$/,
loaders: ['style', 'css?-import'],
exclude: [/lib\/(?!.*redoc-initial-styles).*\.css$/]
},{
test: /\.html$/,
loader: 'raw-loader'
}],
postLoaders: [
/**
* Instruments JS files with Istanbul for subsequent code coverage reporting.
* Instrument only testing sources.
*
* See: https://github.com/deepsweet/istanbul-instrumenter-loader
*/
{
test: /\.(js|ts)$/, loader: 'istanbul-instrumenter-loader',
include: root('lib'),
exclude: [
/\.(e2e|spec)\.ts$/,
/node_modules/
]
}
]
},
plugins: [
new webpack.DefinePlugin({
'IS_PRODUCTION': false,
'LIB_VERSION': VERSION
}),
// ignore changes during tests
new webpack.WatchIgnorePlugin([
/\/ReDoc$/i, // ignore change of ReDoc folder itself
/node_modules\/(?:[^\/]*(?:\/|$))*[^\/]*$/,
/\.tmp\/(?:[^\/]*(?:\/|$))*[^\/]*$/,
/dist\/(?:[^\/]*(?:\/|$))*[^\/]*$/,
/(?:[^\/]*(?:\/|$))*[^\/]*\.css$/ // ignore css files
])
],
}

39
demo/index-gh.html Normal file
View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<title>ReDoc</title>
<link rel="stylesheet" href="main.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.vaadin.com/vaadin-core-elements/latest/webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="https://cdn.vaadin.com/vaadin-core-elements/master/vaadin-combo-box/vaadin-combo-box-light.html">
</head>
<body>
<nav>
<header> <a href="/ReDoc"> ReDoc </a> </header>
<template is="dom-bind" id="specs">
<form id="schema-url-form" is="iron-form">
<vaadin-combo-box-light id="spec-input" items="[[specs]]" allow-custom-value>
<input placeholder="URL to a spec to try" id="schema-url-input" type="text" is="iron-input" value="https://rebilly.github.io/RebillyAPI/swagger.json">
</vaadin-combo-box-light>
<button type="submit"> Explore </button>
</form>
</template>
<iframe src="https://ghbtns.com/github-btn.html?user=Rebilly&repo=ReDoc&type=star&count=true&size=large"
frameborder="0" scrolling="0" width="130px" height="30px"></iframe>
</nav>
<redoc scroll-y-offset="body > nav" spec-url='swagger.yaml'></redoc>
<script src="main.js"> </script>
<script src="./dist/redoc.min.js"> </script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-81703547-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>

View File

@ -25,7 +25,10 @@
<redoc scroll-y-offset="body > nav" spec-url='swagger.yaml'></redoc>
<script src="main.js"> </script>
<script src="./dist/redoc.min.js"> </script>
<script src="/webpack-dev-server.js"></script>
<script src="/polyfills.js"></script>
<script src="/vendor.js"></script>
<script src="/redoc.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

View File

@ -31,7 +31,6 @@
schemaUrlInput = document.getElementById('schema-url-input');
schemaUrlForm.addEventListener('submit', function(event) {
console.log('test')
event.preventDefault();
event.stopPropagation();
location.search = updateQueryStringParameter(location.search, 'url', schemaUrlInput.value)
@ -71,5 +70,4 @@
});
});
});
//window.redocDebugMode = true;
})();

View File

@ -1,2 +0,0 @@
require('shelljs/global');
require('require-dir')('build/tasks');

View File

@ -1,70 +1,48 @@
module.exports = function (config) {
const testWebpackConfig = require('./build/webpack.test.js');
const travis = process.env.TRAVIS;
config.set({
frameworks: ['phantomjs-shim', 'jspm', 'jasmine', 'sinon', 'should'],
frameworks: ['phantomjs-shim', 'jasmine', 'sinon', 'should'],
preprocessors: {
'.tmp/lib/**/!(*spec).js': ['babel', 'coverage']
},
babelPreprocessor: {
options: {
sourceMap: 'inline',
"optional": [
"runtime",
"optimisation.modules.system",
"es7.decorators",
"es7.classProperties"
]
},
sourceFileName: function(file) {
return file.originalPath;
}
'./tests/spec-bundle.js': ['coverage', 'webpack', 'sourcemap']
},
coverageReporter: {
instrumenters: { isparta : require('isparta') },
instrumenter: {
'.tmp/lib/**/!(*spec).js': 'isparta'
},
dir: 'coverage/',
reporters: [
{type: 'html'},
{type: 'lcov'},
{type: 'json'}
{type: 'json'},
{type: 'text-summary'}
]
},
webpack: testWebpackConfig,
webpackMiddleware: {
stats: 'errors-only',
state: true
},
client: {
chai: {
truncateThreshold: 0
}
},
//load angular dependencies and browser polyfills
files: [
'node_modules/zone.js/dist/zone.js',
'node_modules/zone.js/dist/async-test.js',
'node_modules/zone.js/dist/jasmine-patch.js',
'node_modules/zone.js/dist/long-stack-trace-zone.js',
'node_modules/babel-polyfill/dist/polyfill.js',
'./node_modules/reflect-metadata/Reflect.js',
'.tmp/prismjs-bundle.js'
{ pattern: './tests/spec-bundle.js', watched: false },
{ pattern: 'tests/schemas/**/*.json', included: false },
{ pattern: 'tests/schemas/**/*.yml', included: false },
{ pattern: 'lib/**/*.html', included: false },
{ pattern: 'lib/**/*.css', included: false }
],
jspm: {
config: 'system.config.js',
loadFiles: ['.tmp/tests/setup.js', '.tmp/tests/helpers.js', '.tmp/lib/**/*.js',
'.tmp/tests/unit/*.js'],
serveFiles: ['tests/schemas/**/*.json','tests/schemas/**/*.yml', 'lib/**/*.html',
'.tmp/*js', '.tmp/lib/**/*.css']
},
proxies: {
'/.tmp/': '/base/.tmp/',
'/tests/schemas': '/base/tests/schemas',
'/lib/components/redoc/redoc-initial-styles.scss': '/base/.tmp/lib/components/Redoc/redoc-initial-styles.scss',
'/lib/version.json': '/base/.tmp/lib/version.json',
'/lib/': '/base/lib/',
'/jspm_packages/': '/base/jspm_packages/',
'/node_modules/': '/base/node_modules/'
},
reporters: ['mocha', 'coverage'],
colors: true,
singleRun: true,
reporters: travis ? ['mocha', 'coverage', 'coveralls'] : ['mocha', 'coverage'],
browsers: ['PhantomJS'],

6
lib/bootstrap.dev.ts Normal file
View File

@ -0,0 +1,6 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { RedocModule } from './redoc.module';
export function bootstrapRedoc() {
return platformBrowserDynamic().bootstrapModule(RedocModule);
}

6
lib/bootstrap.ts Normal file
View File

@ -0,0 +1,6 @@
import { platformBrowser } from '@angular/platform-browser';
import { RedocModuleNgFactory } from './redoc.module.ngfactory';
export function bootstrapRedoc() {
return platformBrowser().bootstrapModuleFactory(RedocModuleNgFactory);
}

View File

@ -6,7 +6,7 @@
</p>
<p>
<!-- TODO: create separate components for contact and license ? -->
<span *ngIf="info.contact"> Contact:
<span *ngIf="info?.contact"> Contact:
<a *ngIf="info.contact.url" href="{{info.contact.url}}">
{{info.contact.name || info.contact.url}}</a>
<a *ngIf="info.contact.email" href="mailto:{{info.contact.email}}">

View File

@ -1,15 +1,16 @@
'use strict';
import { SpecManager, RedocComponent, BaseComponent } from '../base';
import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core';
import { SpecManager, BaseComponent } from '../base';
import { OptionsService, MenuService } from '../../services/index';
@RedocComponent({
@Component({
selector: 'api-info',
styleUrls: ['./api-info.css'],
templateUrl: './api-info.html'
templateUrl: './api-info.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ApiInfo extends BaseComponent {
info: any;
export class ApiInfo extends BaseComponent implements OnInit {
info: any = {};
specUrl: String;
constructor(specMgr:SpecManager, private optionsService:OptionsService, private menuServ: MenuService) {
super(specMgr);
@ -18,8 +19,12 @@ export class ApiInfo extends BaseComponent {
init() {
this.info = this.componentSchema.info;
this.specUrl = this.optionsService.options.specUrl;
if (parseInt(this.info.version.substring(0, 1)) !== NaN) {
if (!isNaN(parseInt(this.info.version.substring(0, 1)))) {
this.info.version = 'v' + this.info.version;
}
}
ngOnInit() {
this.preinit();
}
}

View File

@ -1,13 +1,14 @@
'use strict';
import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core';
import { BaseComponent, SpecManager } from '../base';
import {RedocComponent, BaseComponent, SpecManager} from '../base';
@RedocComponent({
@Component({
selector: 'api-logo',
styleUrls: ['./api-logo.css'],
templateUrl: './api-logo.html'
templateUrl: './api-logo.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ApiLogo extends BaseComponent {
export class ApiLogo extends BaseComponent implements OnInit {
logo:any = {};
constructor(specMgr:SpecManager) {
@ -20,4 +21,8 @@ export class ApiLogo extends BaseComponent {
this.logo.imgUrl = logoInfo.url;
this.logo.bgColor = logoInfo.backgroundColor || 'transparent';
}
ngOnInit() {
this.preinit();
}
}

View File

@ -23,15 +23,11 @@ describe('Redoc components', () => {
fixture = builder.createSync(TestAppComponent);
let debugEl = getChildDebugElement(fixture.debugElement, 'json-schema-lazy');
component = <JsonSchemaLazy>debugEl.componentInstance;
spyOn(component, '_loadAfterSelf').and.callThrough();
spyOn(component.resolver, 'resolveComponent').and.returnValue({ then: () => {
return { catch: () => {/**/} };
}});
spyOn(component, '_loadAfterSelf').and.stub();
});
afterEach(() => {
component._loadAfterSelf.and.callThrough();
component.resolver.resolveComponent.and.callThrough();
});
it('should init component', () => {
@ -44,14 +40,6 @@ describe('Redoc components', () => {
component.load();
expect(component._loadAfterSelf).toHaveBeenCalled();
});
it('should not run loadNextToLocation if already loaded', () => {
component.pointer = '#/def';
fixture.detectChanges();
component.load();
component.load();
expect(component._loadAfterSelf.calls.count()).toEqual(1);
});
});
});

View File

@ -1,8 +1,7 @@
'use strict';
import { Component, ElementRef, ViewContainerRef, OnDestroy, Input,
AfterViewInit, ComponentResolver, Renderer } from '@angular/core';
import { CORE_DIRECTIVES } from '@angular/common';
AfterViewInit, ComponentFactoryResolver, Renderer } from '@angular/core';
import { JsonSchema } from './json-schema';
import { OptionsService } from '../../services/options.service';
@ -12,8 +11,8 @@ var cache = {};
@Component({
selector: 'json-schema-lazy',
template: '',
directives: [CORE_DIRECTIVES]
entryComponents: [ JsonSchema ],
template: ''
})
export class JsonSchemaLazy implements OnDestroy, AfterViewInit {
@Input() pointer: string;
@ -26,7 +25,7 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit {
disableLazy: boolean = false;
loaded: boolean = false;
constructor(private specMgr:SpecManager, private location:ViewContainerRef, private elementRef:ElementRef,
private resolver:ComponentResolver, private optionsService:OptionsService, private _renderer: Renderer) {
private resolver:ComponentFactoryResolver, private optionsService:OptionsService, private _renderer: Renderer) {
this.disableLazy = this.optionsService.options.disableLazySchemas;
}
@ -36,19 +35,14 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit {
}
_loadAfterSelf() {
this.loaded = true;
return this.resolver.resolveComponent(JsonSchema).then(componentFactory => {
var componentFactory = this.resolver.resolveComponentFactory(JsonSchema);
let contextInjector = this.location.parentInjector;
let compRef = this.location.createComponent(
componentFactory, null, contextInjector, null);
let compRef = this.location.createComponent(componentFactory, null, contextInjector, null);
this.initComponent(compRef.instance);
this._renderer.setElementAttribute(compRef.location.nativeElement, 'class', this.location.element.nativeElement.className);
compRef.changeDetectorRef.detectChanges();
this.loaded = true;
return compRef;
}).catch(err => {
console.log(err);
throw err;
});
}
load() {
@ -63,11 +57,11 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit {
loadCached() {
this.pointer = this.normalizePointer();
if (cache[this.pointer]) {
cache[this.pointer].then((compRef) => {
let compRef = cache[this.pointer];
setTimeout( ()=> {
let $element = compRef.location.nativeElement;
// skip caching view with tabs inside (discriminator)
// skip caching view with descendant schemas
// as it needs attached controller
if (!this.disableLazy && (compRef.instance.hasDescendants || compRef.instance._hasSubSchemas)) {
this._loadAfterSelf();
@ -76,7 +70,6 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit {
insertAfter($element.cloneNode(true), this.elementRef.nativeElement);
this.loaded = true;
});
});
} else {
cache[this.pointer] = this._loadAfterSelf();
}

View File

@ -39,15 +39,15 @@
</div>
</template>
<template ngSwitchCase="array">
<json-schema class="nested-schema" [pointer]="schema._pointer" [isArray]='true'
<json-schema class="nested-schema" [pointer]="schema._pointer"
[nestOdd]="!nestOdd" [isRequestSchema]="isRequestSchema"> </json-schema>
</template>
<template ngSwitchCase="object">
<table class="params-wrap" [ngClass]="{'params-array': schema._isArray}">
<!-- <caption> {{_displayType}} </caption> -->
<template ngFor [ngForOf]="properties" let-prop="$implicit" let-last="last" [ngForTrackBy]="trackByIdx">
<template ngFor [ngForOf]="properties" let-prop="$implicit" let-last="last" [ngForTrackBy]="trackByName">
<tr class="param" [ngClass]="{'last': last,
'discriminator': prop.isDiscriminator && !activeDescendant.empty,
'discriminator': prop.isDiscriminator,
'complex': prop._pointer,
'additional': prop._additional,
'expanded': subSchema.visible
@ -79,8 +79,8 @@
<div class="discriminator-info" *ngIf="prop.isDiscriminator">
<span>This field value determines the exact schema:</span>
<drop-down (change)="selectDescendant($event)">
<option *ngFor="let descendant of schema._descendants; let i=index"
[value]="i">{{descendant.name}}</option>
<option *ngFor="let descendant of descendants; let i=index"
[value]="i" [attr.selected]="descendant.active ? '' : null" >{{descendant.name}}</option>
</drop-down>
</div>
</td>
@ -95,15 +95,6 @@
</td>
</tr>
</template>
<tr *ngIf="hasDescendants" class="param-wrap discriminator-wrap" [ngClass]="{empty:activeDescendant.empty}">
<td colspan="2">
<div class="derived-schema" *ngFor="let descendant of schema._descendants" [ngClass]="{active: descendant.active, empty: descendant.empty}">
<json-schema class="discriminator-part" *ngIf="!descendant.empty" [childFor]="pointer" [nestOdd]="nestOdd"
pointer="{{descendant.$ref}}" [final]="descendant.final" [isRequestSchema]="isRequestSchema">
</json-schema>
</div>
</td>
</tr>
</table>
</template>

View File

@ -155,16 +155,6 @@ table {
border-left-color: transparent;
}
.param.discriminator {
> .param-info {
padding-bottom: 0;
}
> .param-name:after {
display: none;
}
}
.discriminator-info {
font-weight: $regular;
margin-bottom: 10px;

View File

@ -32,7 +32,7 @@ describe('Redoc components', () => {
it('should init component', () => {
component.pointer = '';
(<any>specMgr)._schema = {type: 'object'};
(<SpecManager>specMgr)._schema = {type: 'object'};
fixture.detectChanges();
expect(component).not.toBeNull();
});

View File

@ -1,33 +1,32 @@
'use strict';
import { Input, Renderer, ElementRef, forwardRef } from '@angular/core';
import { Component, Input, Renderer, ElementRef, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { RedocComponent, BaseComponent, SpecManager } from '../base';
import { DropDown } from '../../shared/components/index';
import { BaseComponent, SpecManager } from '../base';
import { SchemaNormalizer, SchemaHelper } from '../../services/index';
import { JsonSchemaLazy } from './json-schema-lazy';
import { Zippy } from '../../shared/components/Zippy/zippy';
@RedocComponent({
@Component({
selector: 'json-schema',
templateUrl: './json-schema.html',
styleUrls: ['./json-schema.css'],
directives: [JsonSchema, DropDown, forwardRef(() => JsonSchemaLazy), Zippy],
detect: true
changeDetection: ChangeDetectionStrategy.OnPush
})
export class JsonSchema extends BaseComponent {
export class JsonSchema extends BaseComponent implements OnInit {
@Input() pointer: string;
@Input() final: boolean = false;
@Input() nestOdd: boolean;
@Input() childFor: string;
@Input() isRequestSchema: boolean;
schema: any = {};
activeDescendant:any = {};
hasDescendants: boolean = false;
_hasSubSchemas: boolean = false;
properties: any;
_isArray: boolean;
@Input() final: boolean = false;
@Input() nestOdd: boolean;
@Input() childFor: string;
@Input() isRequestSchema: boolean;
normalizer: SchemaNormalizer;
autoExpand = false;
descendants: any;
constructor(specMgr:SpecManager, private _renderer: Renderer, private _elementRef: ElementRef) {
super(specMgr);
@ -39,46 +38,40 @@ export class JsonSchema extends BaseComponent {
}
selectDescendant(idx) {
let activeDescendant = this.schema._descendants[idx];
let activeDescendant = this.descendants[idx];
if (!activeDescendant || activeDescendant.active) return;
this.schema._descendants.forEach(subSchema => {
subSchema.active = false;
this.descendants.forEach(d => {
d.active = false;
});
activeDescendant.active = true;
this.activeDescendant = activeDescendant;
this.pointer = activeDescendant.$ref;
this.schema = this.specMgr.byPointer(this.pointer);
this.schema = this.normalizer.normalize(this.schema, this.normPointer, {omitParent: false});
this.preprocessSchema();
}
initDescendants() {
if (!this.schema._descendants || !this.schema._descendants.length) {
return;
}
this.hasDescendants = true;
let enumArr = this.schema._properties[this.schema._properties.length - 1].enum;
if (enumArr) {
let enumOrder = {};
enumArr.forEach((enumItem, idx) => {
enumOrder[enumItem.val] = idx;
});
this.schema._descendants.sort((a, b) => {
return enumOrder[a.name] > enumOrder[b.name] ? 1 : -1;
});
}
this.descendants = this.specMgr.findDerivedDefinitions(this.normPointer);
this.selectDescendant(0);
}
init() {
if (!this.pointer) return;
if (this.nestOdd) {
this._renderer.setElementAttribute(this._elementRef.nativeElement, 'nestodd', 'true');
}
this.schema = this.componentSchema;
if (!this.schema) {
throw new Error(`Can't load component schema at ${this.pointer}`);
}
this.applyStyling();
this.schema = this.normalizer.normalize(this.schema, this.normPointer);
this.schema = SchemaHelper.unwrapArray(this.schema, this.normPointer);
this.initDescendants();
this.preprocessSchema();
}
preprocessSchema() {
SchemaHelper.preprocess(this.schema, this.normPointer, this.pointer);
if (!this.schema.isTrivial) {
@ -92,7 +85,6 @@ export class JsonSchema extends BaseComponent {
this.properties = this.properties && this.properties.filter(prop => !prop.readOnly);
}
this.initDescendants();
this._hasSubSchemas = this.properties && this.properties.some(
propSchema => {
if (propSchema.type === 'array') {
@ -104,7 +96,17 @@ export class JsonSchema extends BaseComponent {
this.autoExpand = this.properties && this.properties.length === 1;
}
trackByIdx(index: number, item: any): number {
return index;
applyStyling() {
if (this.nestOdd) {
this._renderer.setElementAttribute(this._elementRef.nativeElement, 'nestodd', 'true');
}
}
trackByName(index: number, item: any): number {
return item.name;
}
ngOnInit() {
this.preinit();
}
}

View File

@ -1,27 +1,21 @@
'use strict';
import { Input } from '@angular/core';
import { Input, Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
import JsonPointer from '../../utils/JsonPointer';
import { RedocComponent, BaseComponent, SpecManager} from '../base';
import { SelectOnClick } from '../../shared/components/SelectOnClick/select-on-click.directive';
import { ParamsList } from '../ParamsList/params-list';
import { ResponsesList } from '../ResponsesList/responses-list';
import { ResponsesSamples } from '../ResponsesSamples/responses-samples';
import { SchemaSample } from '../SchemaSample/schema-sample';
import { RequestSamples } from '../RequestSamples/request-samples';
import { BaseComponent, SpecManager } from '../base';
import { SchemaHelper } from '../../services/schema-helper.service';
@RedocComponent({
@Component({
selector: 'method',
templateUrl: './method.html',
styleUrls: ['./method.css'],
directives: [ ParamsList, ResponsesList, ResponsesSamples, SchemaSample, RequestSamples, SelectOnClick ],
detect: true
changeDetection: ChangeDetectionStrategy.OnPush
})
export class Method extends BaseComponent {
method:any;
export class Method extends BaseComponent implements OnInit {
@Input() pointer:string;
@Input() tag:string;
method:any;
constructor(specMgr:SpecManager) {
super(specMgr);
}
@ -53,4 +47,8 @@ export class Method extends BaseComponent {
let bodyParam = pathParams.find(param => param.in === 'body');
return bodyParam;
}
ngOnInit() {
this.preinit();
}
}

View File

@ -1,6 +1,6 @@
<div class="methods">
<div class="tag" *ngFor="let tag of tags;trackBy:trackByTagName">
<div class="tag-info" [attr.section]="tag.id" *ngIf="!tag.virtual">
<div class="tag-info" [attr.section]="tag.id" *ngIf="!tag.headless">
<h1 class="sharable-header"> <a class="share-link" href="#tag/{{tag.name | encodeURIComponent}}"></a>{{tag.name}} </h1>
<p *ngIf="tag.description" [innerHtml]="tag.description | marked"> </p>
</div>

View File

@ -1,21 +1,19 @@
'use strict';
import { forwardRef } from '@angular/core';
import { RedocComponent, BaseComponent, SpecManager } from '../base';
import { Method } from '../Method/method';
import { EncodeURIComponentPipe } from '../../utils/pipes';
import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { BaseComponent, SpecManager } from '../base';
import { SchemaHelper } from '../../services/index';
@RedocComponent({
@Component({
selector: 'methods-list',
templateUrl: './methods-list.html',
styleUrls: ['./methods-list.css'],
directives: [ forwardRef(() => Method) ],
pipes: [ EncodeURIComponentPipe ],
detect: true
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MethodsList extends BaseComponent {
export class MethodsList extends BaseComponent implements OnInit {
@Input() pointer:string;
tags:Array<any> = [];
constructor(specMgr:SpecManager) {
super(specMgr);
}
@ -39,4 +37,8 @@ export class MethodsList extends BaseComponent {
trackByTagName(idx, el) {
return el.name;
}
ngOnInit() {
this.preinit();
}
}

View File

@ -1,8 +1,6 @@
'use strict';
import { RedocComponent, BaseComponent, SpecManager } from '../base';
import { JsonSchema } from '../JsonSchema/json-schema';
import { JsonSchemaLazy } from '../JsonSchema/json-schema-lazy';
import { Component, Input, ChangeDetectionStrategy, OnInit } from '@angular/core';
import { BaseComponent, SpecManager } from '../base';
import { SchemaHelper } from '../../services/schema-helper.service';
function safePush(obj, prop, item) {
@ -10,13 +8,14 @@ function safePush(obj, prop, item) {
obj[prop].push(item);
}
@RedocComponent({
@Component({
selector: 'params-list',
templateUrl: './params-list.html',
styleUrls: ['./params-list.css'],
directives: [JsonSchema, JsonSchemaLazy]
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ParamsList extends BaseComponent {
export class ParamsList extends BaseComponent implements OnInit {
@Input() pointer:string;
params: Array<any>;
empty: boolean;
@ -74,4 +73,8 @@ export class ParamsList extends BaseComponent {
params.forEach((param) => safePush(res, param.in, param));
return res;
}
ngOnInit() {
this.preinit();
}
}

View File

@ -198,7 +198,7 @@ footer {
&:before, &:after {
letter-spacing: -0.2em;
content: "\\00a0";
content: "\00a0";
}
}

View File

@ -1,15 +1,14 @@
'use strict';
import { getChildDebugElement } from '../../../tests/helpers';
import { Component, ComponentRef } from '@angular/core';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { Component } from '@angular/core';
import {
inject,
async
} from '@angular/core/testing';
import { TestComponentBuilder } from '@angular/compiler/testing';
import { TestComponentBuilder } from '@angular/core/testing';
import { Redoc } from './redoc';
import { SpecManager } from '../../utils/SpecManager';
@ -45,122 +44,122 @@ describe('Redoc components', () => {
});
});
describe('Redoc init', () => {
let dom = new BrowserDomAdapter();
let elem;
beforeEach(() => {
elem = dom.createElement('redoc');
dom.defaultDoc().body.appendChild(elem);
});
afterEach(() => {
dom.defaultDoc().body.removeChild(elem);
});
it('should return promise', () => {
let res = Redoc.init().catch(() => {/**/});
res.should.be.instanceof(Promise);
});
it('should hide loading animation and display message in case of error', async(() => {
spyOn(Redoc, 'hideLoadingAnimation').and.callThrough();
spyOn(Redoc, 'displayError').and.callThrough();
let res = Redoc.init();
return res.catch(() => {
expect(Redoc.hideLoadingAnimation).toHaveBeenCalled();
expect(Redoc.displayError).toHaveBeenCalled();
});
}));
//skip because of PhantomJS crashes on this testcase
xit('should init redoc', (done) => {
var node = document.createElement('redoc');
document.body.appendChild(node);
let res = Redoc.init('/tests/schemas/extended-petstore.yml');
res.then(() => { done(); }, () => {
done.fail('Error handler should not been called');
});
});
});
describe('Redoc destroy', () => {
let builder;
let fixture;
let element;
let dom;
let destroySpy;
beforeEach(async(inject([TestComponentBuilder, SpecManager, OptionsService, BrowserDomAdapter],
(tcb, specMgr, opts, _dom) => {
builder = tcb;
optsMgr = opts;
dom = _dom;
return specMgr.load('/tests/schemas/extended-petstore.yml');
})));
beforeEach(() => {
fixture = builder.createSync(TestAppComponent);
element = getChildDebugElement(fixture.debugElement, 'methods-list').nativeElement;
destroySpy = jasmine.createSpy('spy');
Redoc.appRef = <ComponentRef<any>>{
destroy: destroySpy
};
fixture.detectChanges();
});
afterEach(()=> {
fixture.destroy();
Redoc.appRef = null;
});
it('should call componentRef.destroy', () => {
Redoc.destroy();
expect(destroySpy).toHaveBeenCalled();
});
it('should create new host element', () => {
element.parentElement.removeChild(element);
Redoc.destroy();
expect(dom.query('redoc')).not.toBeNull();
dom.query('redoc').should.not.be.equal(element);
});
it('should set to null appRef', () => {
Redoc.destroy();
expect(Redoc.appRef).toBeNull();
});
});
describe('Redoc autoInit', () => {
const testURL = 'testurl';
let dom = new BrowserDomAdapter();
//let redocInitSpy;
let elem: HTMLElement;
beforeEach(() => {
spyOn(Redoc, 'init').and.stub();
elem = dom.createElement('redoc');
dom.defaultDoc().body.appendChild(elem);
dom.setAttribute(elem, 'spec-url', testURL);
});
it('should call Redoc.init with url from param spec-url', () => {
Redoc.autoInit();
expect(Redoc.init).toHaveBeenCalled();
expect((<jasmine.Spy>Redoc.init).calls.argsFor(0)).toEqual([testURL]);
});
it('should not call Redoc.init when spec-url param is not provided', () => {
dom.removeAttribute(elem, 'spec-url');
Redoc.autoInit();
expect(Redoc.init).not.toHaveBeenCalled();
});
afterEach(() => {
(<jasmine.Spy>Redoc.init).and.callThrough();
dom.defaultDoc().body.removeChild(elem);
});
});
// describe('Redoc init', () => {
// let dom = new BrowserDomAdapter();
// let elem;
// beforeEach(() => {
// elem = dom.createElement('redoc');
// dom.defaultDoc().body.appendChild(elem);
// });
//
// afterEach(() => {
// dom.defaultDoc().body.removeChild(elem);
// });
//
// it('should return promise', () => {
// let res = Redoc.init().catch(() => {/**/});
// res.should.be.instanceof(Promise);
// });
//
// it('should hide loading animation and display message in case of error', async(() => {
// spyOn(Redoc, 'hideLoadingAnimation').and.callThrough();
// spyOn(Redoc, 'displayError').and.callThrough();
// let res = Redoc.init();
// return res.catch(() => {
// expect(Redoc.hideLoadingAnimation).toHaveBeenCalled();
// expect(Redoc.displayError).toHaveBeenCalled();
// });
// }));
//
// //skip because of PhantomJS crashes on this testcase
// xit('should init redoc', (done) => {
// var node = document.createElement('redoc');
// document.body.appendChild(node);
// let res = Redoc.init('/tests/schemas/extended-petstore.yml');
// res.then(() => { done(); }, () => {
// done.fail('Error handler should not been called');
// });
// });
// });
//
// describe('Redoc destroy', () => {
// let builder;
// let fixture;
// let element;
// let dom;
// let destroySpy;
//
// beforeEach(async(inject([TestComponentBuilder, SpecManager, OptionsService, BrowserDomAdapter],
// (tcb, specMgr, opts, _dom) => {
// builder = tcb;
// optsMgr = opts;
// dom = _dom;
// return specMgr.load('/tests/schemas/extended-petstore.yml');
// })));
//
// beforeEach(() => {
// fixture = builder.createSync(TestAppComponent);
// element = getChildDebugElement(fixture.debugElement, 'methods-list').nativeElement;
// destroySpy = jasmine.createSpy('spy');
// Redoc.appRef = <ComponentRef<any>>{
// destroy: destroySpy
// };
// fixture.detectChanges();
// });
//
// afterEach(()=> {
// fixture.destroy();
// Redoc.appRef = null;
// });
//
// it('should call componentRef.destroy', () => {
// Redoc.destroy();
// expect(destroySpy).toHaveBeenCalled();
// });
//
// it('should create new host element', () => {
// element.parentElement.removeChild(element);
// Redoc.destroy();
// expect(dom.query('redoc')).not.toBeNull();
// dom.query('redoc').should.not.be.equal(element);
// });
//
// it('should set to null appRef', () => {
// Redoc.destroy();
// expect(Redoc.appRef).toBeNull();
// });
// });
//
// describe('Redoc autoInit', () => {
// const testURL = 'testurl';
// let dom = new BrowserDomAdapter();
// //let redocInitSpy;
// let elem: HTMLElement;
//
// beforeEach(() => {
// spyOn(Redoc, 'init').and.stub();
// elem = dom.createElement('redoc');
// dom.defaultDoc().body.appendChild(elem);
// dom.setAttribute(elem, 'spec-url', testURL);
// });
//
// it('should call Redoc.init with url from param spec-url', () => {
// Redoc.autoInit();
// expect(Redoc.init).toHaveBeenCalled();
// expect((<jasmine.Spy>Redoc.init).calls.argsFor(0)).toEqual([testURL]);
// });
//
// it('should not call Redoc.init when spec-url param is not provided', () => {
// dom.removeAttribute(elem, 'spec-url');
// Redoc.autoInit();
// expect(Redoc.init).not.toHaveBeenCalled();
// });
//
// afterEach(() => {
// (<jasmine.Spy>Redoc.init).and.callThrough();
// dom.defaultDoc().body.removeChild(elem);
// });
// });
});
/** Test component that contains a Redoc. */

View File

@ -1,109 +1,46 @@
'use strict';
import { provide, enableProdMode, ElementRef,
ComponentRef, AfterViewInit } from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { RedocComponent, BaseComponent } from '../base';
import { ElementRef, ComponentRef, AfterViewInit, Component, ChangeDetectionStrategy} from '@angular/core';
import detectScollParent from 'scrollparent';
import { BrowserDomAdapter as DOM } from '../../utils/browser-adapter';
import { BaseComponent } from '../base';
import { ApiInfo } from '../ApiInfo/api-info';
import { ApiLogo } from '../ApiLogo/api-logo';
import { MethodsList } from '../MethodsList/methods-list';
import { SideMenu } from '../SideMenu/side-menu';
import { Warnings } from '../Warnings/warnings';
import * as detectScollParent from 'scrollparent';
import { StickySidebar } from '../../shared/components/index';
import {SpecManager} from '../../utils/SpecManager';
import { OptionsService, RedocEventsService, MenuService,
ScrollService, Hash, WarningsService } from '../../services/index';
import { SpecManager } from '../../utils/SpecManager';
import { OptionsService, RedocEventsService } from '../../services/index';
var dom = new BrowserDomAdapter();
var _modeLocked = false;
@RedocComponent({
@Component({
selector: 'redoc',
providers: [
SpecManager,
BrowserDomAdapter,
RedocEventsService,
ScrollService,
Hash,
MenuService,
WarningsService
],
templateUrl: './redoc.html',
styleUrls: ['./redoc.css'],
directives: [ ApiInfo, ApiLogo, MethodsList, SideMenu, StickySidebar, Warnings ],
detect: true,
onPushOnly: false
changeDetection: ChangeDetectionStrategy.OnPush
})
export class Redoc extends BaseComponent implements AfterViewInit {
static appRef: ComponentRef<any>;
static _preOptions: any;
options: any;
public options: any;
private element: any;
static showLoadingAnimation() {
let elem = dom.query('redoc');
dom.addClass(elem, 'loading');
let elem = DOM.query('redoc');
DOM.addClass(elem, 'loading');
}
static hideLoadingAnimation() {
let redocEl = dom.query('redoc');
let redocEl = DOM.query('redoc');
if (!redocEl) return;
dom.addClass(redocEl, 'loading-remove');
DOM.addClass(redocEl, 'loading-remove');
setTimeout(() => {
dom.removeClass(redocEl, 'loading-remove');
dom.removeClass(redocEl, 'loading');
DOM.removeClass(redocEl, 'loading-remove');
DOM.removeClass(redocEl, 'loading');
}, 400);
}
static init(specUrl?, options?) {
var optionsService = new OptionsService(dom);
optionsService.options = options;
optionsService.options.specUrl = optionsService.options.specUrl || specUrl;
var providers = [
provide(OptionsService, {useValue: optionsService})
];
if (Redoc.appRef) {
Redoc.destroy();
}
Redoc.showLoadingAnimation();
return SpecManager.instance().load(specUrl)
.then(() => {
if (!_modeLocked && !optionsService.options.debugMode) {
enableProdMode();
_modeLocked = true;
}
return bootstrap(Redoc, providers);
})
.then(appRef => {
Redoc.hideLoadingAnimation();
Redoc.appRef = appRef;
console.log('ReDoc bootstrapped!');
}).catch(err => {
Redoc.hideLoadingAnimation();
Redoc.displayError(err);
throw err;
});
}
static autoInit() {
const specUrlAttributeName = 'spec-url';
let redocEl = dom.query('redoc');
if (!redocEl) return;
if (dom.hasAttribute(redocEl, specUrlAttributeName)) {
let url = dom.getAttribute(redocEl, specUrlAttributeName);
Redoc.init(url);
}
}
static displayError(err) {
let redocEl = dom.query('redoc');
let redocEl = DOM.query('redoc');
if (!redocEl) return;
let heading = 'Oops... ReDoc failed to render this spec';
let details = err.message;
@ -113,35 +50,17 @@ export class Redoc extends BaseComponent implements AfterViewInit {
redocEl.innerHTML = erroHtml;
}
static destroy() {
let el = dom.query('redoc');
let elClone;
let parent;
let nextSibling;
if (el) {
parent = el.parentElement;
nextSibling = el.nextElementSibling;
}
elClone = el.cloneNode(false);
if (Redoc.appRef) {
Redoc.appRef.destroy();
Redoc.appRef = null;
// Redoc destroy removes host element, so need to restore it
elClone.innerHTML = 'Loading...';
if (parent) parent.insertBefore(elClone, nextSibling);
}
}
constructor(specMgr: SpecManager, optionsMgr:OptionsService, elementRef:ElementRef,
public events:RedocEventsService) {
super(specMgr);
// merge options passed before init
optionsMgr.options = Redoc._preOptions;
this.element = elementRef.nativeElement;
//parse options (top level component doesn't support inputs)
optionsMgr.parseOptions( this.element );
optionsMgr.options.$scrollParent = detectScollParent( this.element );
let scrollParent = detectScollParent( this.element );
if (scrollParent === DOM.defaultDoc().body) scrollParent = window;
optionsMgr.options.$scrollParent = scrollParent;
this.options = optionsMgr.options;
this.events = events;
}

View File

@ -1,34 +1,28 @@
'use strict';
import { ViewChildren, QueryList, EventEmitter, Input} from '@angular/core';
import { Component, ViewChildren, QueryList, EventEmitter, Input,
ChangeDetectionStrategy, OnInit } from '@angular/core';
import { RedocComponent, BaseComponent, SpecManager } from '../base';
import { BaseComponent, SpecManager } from '../base';
import JsonPointer from '../../utils/JsonPointer';
import { Tabs, Tab } from '../../shared/components/index';
import { SchemaSample } from '../SchemaSample/schema-sample';
import { PrismPipe } from '../../utils/pipes';
import { Tabs } from '../../shared/components/index';
import { RedocEventsService } from '../../services/index';
import { CopyButton } from '../../shared/components/CopyButton/copy-button.directive';
@RedocComponent({
@Component({
selector: 'request-samples',
templateUrl: './request-samples.html',
styleUrls: ['./request-samples.css'],
directives: [SchemaSample, Tabs, Tab, CopyButton],
inputs: ['schemaPointer'],
pipes: [PrismPipe],
detect: true,
onPushOnly: false
changeDetection: ChangeDetectionStrategy.OnPush
})
export class RequestSamples extends BaseComponent {
childTabs: Tabs;
selectedLang: EventEmitter<any>;
samples: Array<any>;
export class RequestSamples extends BaseComponent implements OnInit {
@Input() pointer:string;
@Input() schemaPointer:string;
@ViewChildren(Tabs) childQuery:QueryList<Tabs>;
childTabs: Tabs;
selectedLang: EventEmitter<any>;
samples: Array<any>;
constructor(specMgr:SpecManager, public events:RedocEventsService) {
super(specMgr);
@ -44,4 +38,8 @@ export class RequestSamples extends BaseComponent {
this.schemaPointer = JsonPointer.join(this.schemaPointer, 'schema');;
this.samples = this.componentSchema['x-code-samples'] || [];
}
ngOnInit() {
this.preinit();
}
}

View File

@ -1,10 +1,8 @@
'use strict';
import {RedocComponent, BaseComponent, SpecManager} from '../base';
import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { BaseComponent, SpecManager } from '../base';
import JsonPointer from '../../utils/JsonPointer';
import { JsonSchema } from '../JsonSchema/json-schema';
import { JsonSchemaLazy } from '../JsonSchema/json-schema-lazy';
import { Zippy } from '../../shared/components/index';
import { statusCodeType } from '../../utils/helpers';
import { OptionsService } from '../../services/index';
import { SchemaHelper } from '../../services/schema-helper.service';
@ -13,16 +11,18 @@ function isNumeric(n) {
return (!isNaN(parseFloat(n)) && isFinite(n));
}
@RedocComponent({
@Component({
selector: 'responses-list',
templateUrl: './responses-list.html',
styleUrls: ['./responses-list.css'],
directives: [JsonSchema, Zippy, JsonSchemaLazy],
detect: true
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ResponsesList extends BaseComponent {
export class ResponsesList extends BaseComponent implements OnInit {
@Input() pointer:string;
responses: Array<any>;
options: any;
constructor(specMgr:SpecManager, optionsMgr:OptionsService) {
super(specMgr);
this.options = optionsMgr.options;
@ -66,4 +66,8 @@ export class ResponsesList extends BaseComponent {
trackByCode(idx, el) {
return el.code;
}
ngOnInit() {
this.preinit();
}
}

View File

@ -1,10 +1,8 @@
'use strict';
import { forwardRef } from '@angular/core';
import { RedocComponent, BaseComponent, SpecManager } from '../base';
import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { BaseComponent, SpecManager } from '../base';
import JsonPointer from '../../utils/JsonPointer';
import { Tabs, Tab } from '../../shared/components/index';
import { SchemaSample } from '../index';
import { statusCodeType } from '../../utils/helpers';
@ -17,14 +15,17 @@ function hasExample(response) {
response.schema);
}
@RedocComponent({
@Component({
selector: 'responses-samples',
templateUrl: './responses-samples.html',
styleUrls: ['./responses-samples.css'],
directives: [forwardRef( ()=> SchemaSample), Tabs, Tab]
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ResponsesSamples extends BaseComponent {
export class ResponsesSamples extends BaseComponent implements OnInit {
@Input() pointer:string;
data: any;
constructor(specMgr:SpecManager) {
super(specMgr);
}
@ -55,4 +56,8 @@ export class ResponsesSamples extends BaseComponent {
.filter(response => hasExample(response));
this.data.responses = responses;
}
ngOnInit() {
this.preinit();
}
}

View File

@ -8,11 +8,6 @@ pre {
position: relative;
}
// hide top-level collapser
.redoc-json > .collapser {
display: none;
}
.action-buttons {
display: block;
opacity: 0;
@ -175,4 +170,9 @@ pre {
user-select: none;
-webkit-user-select: none;
}
// hide top-level collapser
.redoc-json > .collapser {
display: none;
}
}

View File

@ -1,27 +1,27 @@
'use strict';
import { ElementRef, Input } from '@angular/core';
import { Component, ElementRef, Input, ChangeDetectionStrategy, OnInit } from '@angular/core';
import * as OpenAPISampler from 'openapi-sampler';
import { RedocComponent, BaseComponent, SpecManager } from '../base';
import { BaseComponent, SpecManager } from '../base';
import { JsonFormatter } from '../../utils/JsonFormatterPipe';
import { SchemaNormalizer } from '../../services/schema-normalizer.service';
import { CopyButton } from '../../shared/components/CopyButton/copy-button.directive';
@RedocComponent({
@Component({
selector: 'schema-sample',
templateUrl: './schema-sample.html',
pipes: [JsonFormatter],
directives: [CopyButton],
styleUrls: ['./schema-sample.css']
styleUrls: ['./schema-sample.css'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SchemaSample extends BaseComponent {
export class SchemaSample extends BaseComponent implements OnInit {
@Input() pointer:string;
@Input() skipReadOnly:boolean;
element: any;
sample: any;
enableButtons: boolean = false;
@Input() skipReadOnly:boolean;
private _normalizer:SchemaNormalizer;
@ -136,4 +136,8 @@ export class SchemaSample extends BaseComponent {
expanded.parentNode.classList.add('collapsed');
}
}
ngOnInit() {
this.preinit();
}
}

View File

@ -11,7 +11,7 @@
<label class="menu-cat-header" (click)="activateAndScroll(idx, -1)" [hidden]="cat.headless"
[ngClass]="{active: cat.active}"> {{cat.name}}</label>
<ul class="menu-subitems" @itemAnimation="cat.active ? 'expanded' : 'collapsed'">
<ul class="menu-subitems" [@itemAnimation]="cat.active ? 'expanded' : 'collapsed'">
<li *ngFor="let method of cat.methods; trackBy:summary; let methIdx = index"
[ngClass]="{active: method.active}"
(click)="activateAndScroll(idx, methIdx)">

View File

@ -9,11 +9,11 @@ import {
async
} from '@angular/core/testing';
import { TestComponentBuilder } from '@angular/compiler/testing';
import { TestComponentBuilder } from '@angular/core/testing';
import { MethodsList, SideMenu } from '../index';
import { SpecManager } from '../../utils/SpecManager';;
import { SpecManager } from '../../utils/SpecManager';
let testOptions;

View File

@ -1,21 +1,18 @@
'use strict';
import { ElementRef, ChangeDetectorRef } from '@angular/core';
import { Component, ElementRef, ChangeDetectorRef, OnInit } from '@angular/core';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { global } from '@angular/core/src/facade/lang';
import { trigger, state, animate, transition, style } from '@angular/core';
import { RedocComponent, BaseComponent, SpecManager } from '../base';
import { BaseComponent, SpecManager } from '../base';
import { ScrollService, Hash, MenuService, OptionsService } from '../../services/index';
import { BrowserDomAdapter as DOM } from '../../utils/browser-adapter';
import { MenuCategory } from '../../services/schema-helper.service';
@RedocComponent({
@Component({
selector: 'side-menu',
templateUrl: './side-menu.html',
styleUrls: ['./side-menu.css'],
detect: true,
onPushOnly: false,
animations: [
trigger('itemAnimation', [
state('collapsed, void',
@ -28,7 +25,7 @@ import { MenuCategory } from '../../services/schema-helper.service';
])
],
})
export class SideMenu extends BaseComponent {
export class SideMenu extends BaseComponent implements OnInit {
activeCatCaption: string;
activeItemCaption: string;
categories: Array<MenuCategory>;
@ -39,7 +36,7 @@ export class SideMenu extends BaseComponent {
private $resourcesNav: any;
private $scrollParent: any;
constructor(specMgr:SpecManager, elementRef:ElementRef, private dom:BrowserDomAdapter,
constructor(specMgr:SpecManager, elementRef:ElementRef,
private scrollService:ScrollService, private menuService:MenuService, private hash:Hash,
optionsService:OptionsService, private detectorRef:ChangeDetectorRef) {
super(specMgr);
@ -58,6 +55,7 @@ export class SideMenu extends BaseComponent {
this.activeItemCaption = item && item.summary || '';
//safari doesn't update bindings if not run changeDetector manually :(
this.detectorRef.detectChanges();
}
@ -72,8 +70,8 @@ export class SideMenu extends BaseComponent {
init() {
this.categories = this.menuService.categories;
this.$mobileNav = this.dom.querySelector(this.$element, '.mobile-nav');
this.$resourcesNav = this.dom.querySelector(this.$element, '#resources-nav');
this.$mobileNav = DOM.querySelector(this.$element, '.mobile-nav');
this.$resourcesNav = DOM.querySelector(this.$element, '#resources-nav');
//decorate scrollYOffset to account mobile nav
this.scrollService.scrollYOffset = () => {
@ -87,18 +85,17 @@ export class SideMenu extends BaseComponent {
}
toggleMobileNav() {
let dom = this.dom;
let $overflowParent = (this.options.$scrollParent === global) ? dom.defaultDoc().body
let $overflowParent = (this.options.$scrollParent === global) ? DOM.defaultDoc().body
: this.$scrollParent;
if (dom.hasStyle(this.$resourcesNav, 'height')) {
dom.removeStyle(this.$resourcesNav, 'height');
dom.removeStyle($overflowParent, 'overflow-y');
if (DOM.hasStyle(this.$resourcesNav, 'height')) {
DOM.removeStyle(this.$resourcesNav, 'height');
DOM.removeStyle($overflowParent, 'overflow-y');
} else {
let viewportHeight = this.options.$scrollParent.innerHeight
|| this.options.$scrollParent.clientHeight;
let height = viewportHeight - this.$mobileNav.getBoundingClientRect().bottom;
dom.setStyle($overflowParent, 'overflow-y', 'hidden');
dom.setStyle(this.$resourcesNav, 'height', height + 'px');
DOM.setStyle($overflowParent, 'overflow-y', 'hidden');
DOM.setStyle(this.$resourcesNav, 'height', height + 'px');
}
}
@ -106,4 +103,8 @@ export class SideMenu extends BaseComponent {
this.scrollService.unbind();
this.hash.unbind();
}
ngOnInit() {
this.preinit();
}
}

View File

@ -1,16 +1,15 @@
'use strict';
import { SpecManager, RedocComponent, BaseComponent } from '../base';
import { Component, OnInit } from '@angular/core';
import { SpecManager, BaseComponent } from '../base';
import { WarningsService, OptionsService } from '../../services/index';
@RedocComponent({
@Component({
selector: 'warnings',
styleUrls: ['./warnings.css'],
templateUrl: './warnings.html',
detect: true,
onPushOnly: false
templateUrl: './warnings.html'
})
export class Warnings extends BaseComponent {
export class Warnings extends BaseComponent implements OnInit {
warnings: Array<string> = [];
shown: boolean = false;
suppressWarnings: boolean;
@ -30,4 +29,8 @@ export class Warnings extends BaseComponent {
close() {
this.shown = false;
}
ngOnInit() {
this.preinit();
}
}

View File

@ -1,21 +1,10 @@
'use strict';
import { Component, ChangeDetectionStrategy, OnInit, OnDestroy } from '@angular/core';
import { CORE_DIRECTIVES, JsonPipe, AsyncPipe } from '@angular/common';
import { OnInit, OnDestroy } from '@angular/core';
import { SpecManager } from '../utils/SpecManager';
import { MarkedPipe, JsonPointerEscapePipe, SafePipe } from '../utils/pipes';
export { SpecManager };
// common inputs for all components
let commonInputs = ['pointer']; // json pointer to the schema chunk
// internal helper function
function safeConcat(a, b) {
let res = a && a.slice() || [];
b = (b == undefined) ? [] : b;
return res.concat(b);
}
function snapshot(obj) {
if(obj == undefined || typeof(obj) !== 'object') {
return obj;
@ -32,54 +21,13 @@ function snapshot(obj) {
return temp;
}
/**
* Class decorator
* Simplifies setup of component metainfo
* All options are options from either Component or View angular2 decorator
* For detailed info look angular2 doc
* @param {Object} options - component options
* @param {string[]} options.inputs - component inputs
* @param {*[]} options.directives - directives used by component
* (except CORE_DIRECTIVES)
* @param {*[]} options.pipes - pipes used by component
* @param {*[]} options.providers - component providers
* @param {string} options.templateUrl - path to component template
* @param {string} options.template - component template html
* @param {string} options.styles - component css styles
*/
export function RedocComponent(options) {
let inputs = safeConcat(options.inputs, commonInputs);
let directives = safeConcat(options.directives, CORE_DIRECTIVES);
let pipes = safeConcat(options.pipes, [JsonPointerEscapePipe, MarkedPipe, JsonPipe, AsyncPipe, SafePipe]);
if (options.onPushOnly === undefined) options.onPushOnly = true;
return function decorator(target) {
let componentDecorator = Component({
selector: options.selector,
inputs: inputs,
outputs: options.outputs,
providers: options.providers,
changeDetection: options.onPushOnly ? ChangeDetectionStrategy.OnPush : ChangeDetectionStrategy.Default,
animations: options.animations,
templateUrl: options.templateUrl,
template: options.template,
styles: options.styles,
directives: directives,
pipes: pipes
});
return componentDecorator(target) || target;
};
}
/**
* Generic Component
* @class
*/
export class BaseComponent implements OnInit, OnDestroy {
componentSchema: any = null;
pointer: string;
componentSchema: any = null;
dereferencedCache = {};
constructor(public specMgr: SpecManager) {
@ -89,6 +37,10 @@ export class BaseComponent implements OnInit, OnDestroy {
* onInit method is run by angular2 after all component inputs are resolved
*/
ngOnInit() {
this.preinit();
}
preinit() {
this.componentSchema = this.specMgr.byPointer(this.pointer || '');
this.init();
}

View File

@ -1,16 +1,25 @@
'use strict';
export * from './ApiInfo/api-info';
export * from './ApiLogo/api-logo';
export * from './JsonSchema/json-schema';
export * from './JsonSchema/json-schema-lazy';
export * from './ParamsList/params-list';
export * from './RequestSamples/request-samples';
export * from './ResponsesList/responses-list';
export * from './ResponsesSamples/responses-samples';
export * from './SchemaSample/schema-sample';
export * from './SideMenu/side-menu';
export * from './MethodsList/methods-list';
export * from './Method/method';
import { ApiInfo } from './ApiInfo/api-info';
import { ApiLogo } from './ApiLogo/api-logo';
import { JsonSchema } from './JsonSchema/json-schema';
import { JsonSchemaLazy } from './JsonSchema/json-schema-lazy';
import { ParamsList } from './ParamsList/params-list';
import { RequestSamples } from './RequestSamples/request-samples';
import { ResponsesList } from './ResponsesList/responses-list';
import { ResponsesSamples } from './ResponsesSamples/responses-samples';
import { SchemaSample } from './SchemaSample/schema-sample';
import { SideMenu } from './SideMenu/side-menu';
import { MethodsList } from './MethodsList/methods-list';
import { Method } from './Method/method';
import { Warnings } from './Warnings/warnings';
export * from './Redoc/redoc';
import { Redoc } from './Redoc/redoc';
export const REDOC_DIRECTIVES = [
ApiInfo, ApiLogo, JsonSchema, JsonSchemaLazy, ParamsList, RequestSamples, ResponsesList,
ResponsesSamples, SchemaSample, SideMenu, MethodsList, Method, Warnings, Redoc
];
export { ApiInfo, ApiLogo, JsonSchema, JsonSchemaLazy, ParamsList, RequestSamples, ResponsesList,
ResponsesSamples, SchemaSample, SideMenu, MethodsList, Method, Warnings, Redoc }

View File

@ -1,15 +0,0 @@
'use strict';
import './components/Redoc/redoc-initial-styles.css!css';
import 'dropkickjs/build/css/dropkick.css!css';
import 'prismjs/themes/prism-dark.css!css';
import 'hint.css/hint.base.css!css';
import { redocVersion } from './version.js';
import { Redoc } from './components/index';
Redoc.version = redocVersion;
export var init = Redoc.init;
window['Redoc'] = Redoc;
Redoc.autoInit();

58
lib/index.ts Normal file
View File

@ -0,0 +1,58 @@
'use strict';
import './components/Redoc/redoc-initial-styles.css';
import { enableProdMode } from '@angular/core';
import { Redoc } from './components/index';
import { SpecManager } from './utils/SpecManager';
import { BrowserDomAdapter as DOM } from './utils/browser-adapter';
import { disableDebugTools } from '@angular/platform-browser';
import { bootstrapRedoc } from './bootstrap';
if (IS_PRODUCTION) {
disableDebugTools();
enableProdMode();
}
export const version = LIB_VERSION;
var moduleRef;
export function init(specUrl:string, options:any = {}) {
if (moduleRef) {
destroy();
}
Redoc._preOptions = options;
options.specUrl = options.specUrl || specUrl;
Redoc.showLoadingAnimation();
return SpecManager.instance().load(specUrl)
.then(() => {
return bootstrapRedoc();
})
.then(appRef => {
Redoc.hideLoadingAnimation();
moduleRef = appRef;
console.log('ReDoc initialized!');
}).catch(err => {
Redoc.hideLoadingAnimation();
Redoc.displayError(err);
throw err;
});
};
export function destroy() {
moduleRef.destroy();
};
function autoInit() {
const specUrlAttributeName = 'spec-url';
let redocEl = DOM.query('redoc');
if (!redocEl) return;
if (DOM.hasAttribute(redocEl, specUrlAttributeName)) {
let url = DOM.getAttribute(redocEl, specUrlAttributeName);
init(url);
}
};
autoInit();

4
lib/polyfills.ts Normal file
View File

@ -0,0 +1,4 @@
import 'core-js/es6';
import 'core-js/es7/reflect';
import 'ts-helpers';
import 'zone.js/dist/zone';

27
lib/redoc.module.ts Normal file
View File

@ -0,0 +1,27 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { Redoc, REDOC_DIRECTIVES } from './components/index';
import { REDOC_COMMON_DIRECTIVES } from './shared/components/index';
import { REDOC_PIPES } from './utils/pipes';
import { OptionsService, RedocEventsService, MenuService,
ScrollService, Hash, WarningsService } from './services/index';
import { SpecManager } from './utils/SpecManager';
@NgModule({
imports: [ BrowserModule ],
declarations: [ REDOC_DIRECTIVES, REDOC_COMMON_DIRECTIVES, REDOC_PIPES],
bootstrap: [ Redoc ],
providers: [
SpecManager,
RedocEventsService,
ScrollService,
Hash,
MenuService,
WarningsService,
OptionsService
]
})
export class RedocModule {
}

View File

@ -1,7 +1,5 @@
'use strict';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { RedocEventsService } from './events.service';
import { Hash } from './hash.service';
@ -10,7 +8,7 @@ describe('Hash Service', () => {
let hashService;
beforeEach(() => {
hashService = new Hash(new BrowserDomAdapter(), events);
hashService = new Hash(events);
});
afterEach(() => {

View File

@ -1,6 +1,6 @@
'use strict';
import { Injectable, EventEmitter, Output } from '@angular/core';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { BrowserDomAdapter as DOM } from '../utils/browser-adapter';
import { global } from '@angular/core/src/facade/lang';
import { RedocEventsService } from './events.service';
@ -9,18 +9,18 @@ import { RedocEventsService } from './events.service';
export class Hash {
@Output() changed = new EventEmitter();
private _cancel: any;
constructor(private dom:BrowserDomAdapter, private events:RedocEventsService) {
constructor(private events:RedocEventsService) {
this.bind();
events.bootstrapped.subscribe(() => this.changed.next(this.hash));
}
get hash() {
return this.dom.getLocation().hash;
return DOM.getLocation().hash;
}
bind() {
this._cancel = this.dom.onAndCancel(global, 'hashchange', (evt) => {
this._cancel = DOM.onAndCancel(global, 'hashchange', (evt) => {
this.changed.next(this.hash);
evt.preventDefault();
});

View File

@ -1,6 +1,5 @@
'use strict';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { OptionsService } from './options.service';
describe('Options Service', () => {
@ -19,7 +18,7 @@ describe('Options Service', () => {
});
beforeEach(() => {
optionsService = new OptionsService(new BrowserDomAdapter());
optionsService = new OptionsService();
});
it('should parse numeric scrollYOffset', () => {

View File

@ -1,12 +1,11 @@
'use strict';
import { Injectable } from '@angular/core';
import { isFunction, isString } from '@angular/core/src/facade/lang';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { BrowserDomAdapter as DOM } from '../utils/browser-adapter';
const defaults = {
scrollYOffset: 0,
disableLazySchemas: false,
debugMode: false//global && global.redocDebugMode
disableLazySchemas: false
};
const OPTION_NAMES = new Set(['scrollYOffset', 'disableLazySchemas', 'specUrl', 'suppressWarnings']);
@ -15,9 +14,8 @@ const OPTION_NAMES = new Set(['scrollYOffset', 'disableLazySchemas', 'specUrl',
export class OptionsService {
private _options: any;
constructor(private dom:BrowserDomAdapter) {
constructor() {
this._options = defaults;
this.dom = dom;
}
get options() {
@ -30,7 +28,7 @@ export class OptionsService {
parseOptions(el) {
let parsedOpts;
let attributesMap = this.dom.attributeMap(el);
let attributesMap = DOM.attributeMap(el);
parsedOpts = {};
Array.from(attributesMap.keys())
//camelCasify
@ -59,7 +57,7 @@ export class OptionsService {
// if selector or node function that returns bottom offset of this node
let el = this._options.scrollYOffset;
if (!(el instanceof Node)) {
el = this.dom.query(el);
el = DOM.query(el);
}
if (!el) {
this._options.scrollYOffset = () => 0;

View File

@ -3,7 +3,7 @@ import { JsonPointer } from '../utils/JsonPointer';
import { SpecManager } from '../utils/SpecManager';
import {methods as swaggerMethods, keywordTypes} from '../utils/swagger-defs';
import { WarningsService } from './warnings.service';
import slugify from 'slugify';
import * as slugify from 'slugify';
interface PropertyPreprocessOptions {
childFor: string;
@ -59,7 +59,6 @@ const injectors = {
discriminator: {
check: (propertySchema) => propertySchema.discriminator,
inject: (injectTo, propertySchema = injectTo, pointer) => {
injectTo._descendants = SpecManager.instance().findDerivedDefinitions(pointer);
injectTo.discriminator = propertySchema.discriminator;
}
},
@ -68,11 +67,15 @@ const injectors = {
return propertySchema.type === 'array' && !Array.isArray(propertySchema.items);
},
inject: (injectTo, propertySchema = injectTo, propPointer) => {
if (!(SchemaHelper.detectType(propertySchema.items) === 'object')) {
injectTo._isArray = true;
injectTo._pointer = propertySchema.items._pointer
|| JsonPointer.join(propertySchema._pointer || propPointer, ['items']);
SchemaHelper.runInjectors(injectTo, propertySchema.items, propPointer);
} else {
injectors.object.inject(injectTo, propertySchema.items);
}
injectTo._widgetType = 'array';
}
},
@ -89,12 +92,12 @@ const injectors = {
itemSchema._pointer = itemSchema._pointer || JsonPointer.join(itemsPtr, [i.toString()]);
}
injectTo._widgetType = 'tuple';
// SchemaHelper.runInjectors(injectTo, propertySchema.items, propPointer);
}
},
object: {
check: (propertySchema) => {
return propertySchema.type === 'object' && propertySchema.properties;
return propertySchema.type === 'object' && (propertySchema.properties ||
typeof propertySchema.additionalProperties === 'object');
},
inject: (injectTo, propertySchema = injectTo) => {
let baseName = propertySchema._pointer && JsonPointer.baseName(propertySchema._pointer);
@ -215,7 +218,6 @@ export class SchemaHelper {
schema.required.forEach(prop => requiredMap[prop] = true);
}
let discriminatorFieldIdx = -1;
let props = schema.properties && Object.keys(schema.properties).map((propName, idx) => {
let propertySchema = Object.assign({}, schema.properties[propName]);
let propPointer = propertySchema._pointer ||
@ -228,9 +230,6 @@ export class SchemaHelper {
}
propertySchema._required = !!requiredMap[propName];
propertySchema.isDiscriminator = (schema.discriminator === propName);
if (propertySchema.isDiscriminator) {
discriminatorFieldIdx = idx;
}
return propertySchema;
});
@ -242,11 +241,6 @@ export class SchemaHelper {
props.push(propsSchema);
}
// Move discriminator field to the end of properties list
if (discriminatorFieldIdx > -1) {
let discrProp = props.splice(discriminatorFieldIdx, 1);
props.push(discrProp[0]);
}
// filter readOnly props for request schemas
if (opts.skipReadOnly) {
props = props.filter(prop => !prop.readOnly);
@ -280,6 +274,7 @@ export class SchemaHelper {
}
static detectType(schema) {
if (schema.type) return schema.type;
let keywords = Object.keys(keywordTypes);
for (var i=0; i < keywords.length; i++) {
let keyword = keywords[i];

View File

@ -102,8 +102,10 @@ class AllOfMerger {
AllOfMerger.mergeObject(into, subSchema, i);
}
// don't merge _pointer
let tmpPtr = subSchema._pointer;
subSchema._pointer = null;
defaults(into, subSchema);
subSchema._pointer = tmpPtr;
}
into.allOf = null;
}

View File

@ -1,7 +1,8 @@
'use strict';
import { Injectable, EventEmitter, Output } from '@angular/core';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { BrowserDomAdapter as DOM } from '../utils/browser-adapter';
import { OptionsService } from './options.service';
import { throttle } from '../utils/helpers';
export const INVIEW_POSITION = {
ABOVE : 1,
@ -16,12 +17,11 @@ export class ScrollService {
@Output() scroll = new EventEmitter();
private prevOffsetY: number;
private _cancel:any;
constructor(private dom:BrowserDomAdapter, optionsService:OptionsService) {
constructor(optionsService:OptionsService) {
//events.bootstrapped.subscribe(() => this.hashScroll());
this.scrollYOffset = () => optionsService.options.scrollYOffset();
this.$scrollParent = optionsService.options.$scrollParent;
this.scroll = new EventEmitter();
this.dom = dom;
this.bind();
}
@ -60,7 +60,8 @@ export class ScrollService {
bind() {
this.prevOffsetY = this.scrollY();
this._cancel = this.dom.onAndCancel(this.$scrollParent, 'scroll', (evt) => { this.scrollHandler(evt); });
this._cancel = DOM.onAndCancel(this.$scrollParent, 'scroll',
throttle((evt) => { this.scrollHandler(evt); }, 100, this));
}
unbind() {

View File

@ -1,8 +1,7 @@
'use strict';
import { Component, EventEmitter, ElementRef, Output, AfterContentInit } from '@angular/core';
import { CORE_DIRECTIVES } from '@angular/common';
import DropKick from 'dropkickjs';
import * as DropKick from 'dropkickjs';
@Component({
selector: 'drop-down',
@ -11,7 +10,6 @@ import DropKick from 'dropkickjs';
<ng-content></ng-content>
</select>
`,
directives: [CORE_DIRECTIVES],
styleUrls: ['./drop-down.css']
})
export class DropDown implements AfterContentInit {

View File

@ -27,10 +27,10 @@ describe('Common components', () => {
expect(component).not.toBeNull();
});
it('should start unsticked', () => {
it('should start sticked', () => {
spyOn(component, 'stick').and.callThrough();
fixture.detectChanges();
expect(component.stick).not.toHaveBeenCalled();
expect(component.stick).toHaveBeenCalled();
});
it('should stick if scrolled more than scrollYOffset', () => {

View File

@ -1,7 +1,7 @@
'use strict';
import { Directive, ElementRef, Input, OnInit, OnDestroy } from '@angular/core';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { BrowserDomAdapter as DOM } from '../../../utils/browser-adapter';
@Directive({
selector: '[sticky-sidebar]'
@ -13,19 +13,18 @@ export class StickySidebar implements OnInit, OnDestroy {
@Input() scrollParent:any;
@Input() scrollYOffset:any;
constructor(elementRef:ElementRef, private dom:BrowserDomAdapter) {
constructor(elementRef:ElementRef) {
this.$element = elementRef.nativeElement;
// initial styling
this.dom.setStyle(this.$element, 'position', 'absolute');
this.dom.setStyle(this.$element, 'top', '0');
this.dom.setStyle(this.$element, 'bottom', '0');
this.dom.setStyle(this.$element, 'max-height', '100%');
DOM.setStyle(this.$element, 'position', 'absolute');
DOM.setStyle(this.$element, 'top', '0');
DOM.setStyle(this.$element, 'bottom', '0');
DOM.setStyle(this.$element, 'max-height', '100%');
}
bind() {
this.cancelScrollBinding = this.dom.onAndCancel(this.scrollParent, 'scroll', () => { this.updatePosition(); });
this.updatePosition();
this.cancelScrollBinding = DOM.onAndCancel(this.scrollParent, 'scroll', () => { this.updatePosition(); });
}
unbind() {
@ -41,13 +40,13 @@ export class StickySidebar implements OnInit, OnDestroy {
}
stick() {
this.dom.setStyle(this.$element, 'position', 'fixed');
this.dom.setStyle(this.$element, 'top', this.scrollYOffset() + 'px');
DOM.setStyle(this.$element, 'position', 'fixed');
DOM.setStyle(this.$element, 'top', this.scrollYOffset() + 'px');
}
unstick() {
this.dom.setStyle(this.$element, 'position', 'absolute');
this.dom.setStyle(this.$element, 'top', '0');
DOM.setStyle(this.$element, 'position', 'absolute');
DOM.setStyle(this.$element, 'top', '0');
}
get scrollY() {
@ -56,8 +55,9 @@ export class StickySidebar implements OnInit, OnDestroy {
ngOnInit() {
// FIXME use more reliable code
this.$redocEl = this.$element.offsetParent || this.dom.defaultDoc().body;
this.$redocEl = this.$element.offsetParent.parentNode || DOM.defaultDoc().body;
this.bind();
this.updatePosition();
}
ngOnDestroy() {

View File

@ -1,7 +1,6 @@
'use strict';
import { Component, EventEmitter, Input, Output, OnInit } from '@angular/core';
import { CORE_DIRECTIVES } from '@angular/common';
import { ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';
@Component({
@ -13,7 +12,6 @@ import { ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';
</ul>
<ng-content></ng-content>
`,
directives: [CORE_DIRECTIVES],
styleUrls: ['tabs.css'],
changeDetection: ChangeDetectionStrategy.OnPush
})
@ -70,7 +68,6 @@ export class Tabs implements OnInit {
<ng-content></ng-content>
</div>
`,
directives: [CORE_DIRECTIVES],
styles: [`
.tab-wrap {
display: none;

View File

@ -5,7 +5,6 @@ import { getChildDebugElement, mouseclick } from '../../../../tests/helpers';
import { Component } from '@angular/core';
import {
inject,
expect,
TestComponentBuilder
} from '@angular/core/testing';

View File

@ -1,13 +1,10 @@
'use strict';
import { Component, EventEmitter, Output, Input } from '@angular/core';
import { CORE_DIRECTIVES } from '@angular/common';
@Component({
selector: 'zippy',
templateUrl: './zippy.html',
styleUrls: ['./zippy.css'],
directives: [CORE_DIRECTIVES]
styleUrls: ['./zippy.css']
})
export class Zippy {
@Input() type = 'general';

View File

@ -1,5 +1,13 @@
'use strict';
export * from './DropDown/drop-down';
export * from './StickySidebar/sticky-sidebar';
export * from './Tabs/tabs';
export * from './Zippy/zippy';
import { DropDown } from './DropDown/drop-down';
import { StickySidebar } from './StickySidebar/sticky-sidebar';
import { Tabs, Tab } from './Tabs/tabs';
import { Zippy } from './Zippy/zippy';
import { CopyButton } from './CopyButton/copy-button.directive';
import { SelectOnClick } from './SelectOnClick/select-on-click.directive';
export const REDOC_COMMON_DIRECTIVES = [
DropDown, StickySidebar, Tabs, Tab, Zippy, CopyButton, SelectOnClick
];
export { DropDown, StickySidebar, Tabs, Tab, Zippy, CopyButton, SelectOnClick }

View File

@ -1,5 +1,5 @@
'use strict';
import JsonPointerLib from 'json-pointer';
import * as JsonPointerLib from 'json-pointer';
const origParse = JsonPointerLib.parse;
/**

View File

@ -1,9 +1,9 @@
'use strict';
import JsonSchemaRefParser from 'json-schema-ref-parser';
import JsonPointer from './JsonPointer';
import * as JsonSchemaRefParser from 'json-schema-ref-parser';
import { JsonPointer } from './JsonPointer';
import { renderMd, safePush } from './helpers';
import slugify from 'slugify';
import * as slugify from 'slugify';
import { parse as urlParse } from 'url';
export class SpecManager {
@ -32,8 +32,8 @@ export class SpecManager {
.then(schema => {
this._url = url;
this._schema = schema;
resolve(this._schema);
this.init();
return resolve(this._schema);
}, err => reject(err));
});
@ -163,11 +163,7 @@ export class SpecManager {
let idx = subTypes.findIndex(ref => ref === defPointer);
if (idx < 0) continue;
let empty = false;
if (subTypes.length === 1) {
empty = true;
}
res.push({name: defName, $ref: `#/definitions/${defName}`, empty});
res.push({name: defName, $ref: `#/definitions/${defName}`});
}
return res;
}

View File

@ -0,0 +1,73 @@
export class BrowserDomAdapter {
static query(selector: string): any { return document.querySelector(selector); }
static querySelector(el: any /** TODO #9100 */, selector: string): HTMLElement {
return el.querySelector(selector);
}
static onAndCancel(
el: any /** TODO #9100 */, evt: any /** TODO #9100 */,
listener: any /** TODO #9100 */): Function {
el.addEventListener(evt, listener, false);
// Needed to follow Dart's subscription semantic, until fix of
// https://code.google.com/p/dart/issues/detail?id=17406
return () => { el.removeEventListener(evt, listener, false); };
}
static addClass(element: any /** TODO #9100 */, className: string) { element.classList.add(className); }
static removeClass(element: any /** TODO #9100 */, className: string) {
element.classList.remove(className);
}
static hasClass(element: any /** TODO #9100 */, className: string): boolean {
return element.classList.contains(className);
}
static attributeMap(element: any /** TODO #9100 */): Map<string, string> {
var res = new Map<string, string>();
var elAttrs = element.attributes;
for (var i = 0; i < elAttrs.length; i++) {
var attrib = elAttrs[i];
res.set(attrib.name, attrib.value);
}
return res;
}
static setStyle(element: any /** TODO #9100 */, styleName: string, styleValue: string) {
element.style[styleName] = styleValue;
}
static removeStyle(element: any /** TODO #9100 */, stylename: string) {
element.style[stylename] = null;
}
static getStyle(element: any /** TODO #9100 */, stylename: string): string {
return element.style[stylename];
}
static hasStyle(element: any /** TODO #9100 */, styleName: string, styleValue: string = null): boolean {
var value = this.getStyle(element, styleName) || '';
return styleValue ? value === styleValue : value.length > 0;
}
static hasAttribute(element: any /** TODO #9100 */, attribute: string): boolean {
return element.hasAttribute(attribute);
}
static getAttribute(element: any /** TODO #9100 */, attribute: string): string {
return element.getAttribute(attribute);
}
static setAttribute(element: any /** TODO #9100 */, name: string, value: string) {
element.setAttribute(name, value);
}
static removeAttribute(element: any /** TODO #9100 */, attribute: string) {
element.removeAttribute(attribute);
}
static getLocation(): Location { return window.location; }
static defaultDoc(): HTMLDocument { return document; }
}

103
lib/utils/helpers.js Normal file
View File

@ -0,0 +1,103 @@
'use strict';
var Remarkable = require('remarkable');
var md = new Remarkable({
html: true,
linkify: true,
breaks: false,
typographer: false,
highlight: function (str, lang) {
if (lang === 'json')
lang = 'js';
var grammar = Prism.languages[lang];
if (!grammar)
return str;
return Prism.highlight(str, grammar);
}
});
function renderMd(rawText, headersHandler) {
var _origRule;
if (headersHandler) {
_origRule = {
open: md.renderer.rules.heading_open,
close: md.renderer.rules.heading_close
};
md.renderer.rules.heading_open = function (tokens, idx) {
if (tokens[idx].hLevel !== 1) {
return _origRule.open(tokens, idx);
}
else {
return headersHandler.open(tokens, idx);
}
};
md.renderer.rules.heading_close = function (tokens, idx) {
if (tokens[idx].hLevel !== 1) {
return _origRule.close(tokens, idx);
}
else {
return headersHandler.close(tokens, idx);
}
};
}
var res = md.render(rawText);
if (headersHandler) {
md.renderer.rules.heading_open = _origRule.open;
md.renderer.rules.heading_close = _origRule.close;
}
return res;
}
exports.renderMd = renderMd;
function statusCodeType(statusCode) {
if (statusCode < 100 || statusCode > 599) {
throw new Error('invalid HTTP code');
}
var res = 'success';
if (statusCode >= 300 && statusCode < 400) {
res = 'redirect';
}
else if (statusCode >= 400) {
res = 'error';
}
else if (statusCode < 200) {
res = 'info';
}
return res;
}
exports.statusCodeType = statusCodeType;
function defaults(target, src) {
var props = Object.keys(src);
var index = -1, length = props.length;
while (++index < length) {
var key = props[index];
if (target[key] === undefined) {
target[key] = src[key];
}
}
return target;
}
exports.defaults = defaults;
function safePush(obj, prop, val) {
if (!obj[prop])
obj[prop] = [];
obj[prop].push(val);
}
exports.safePush = safePush;
function throttle(fn, threshhold, scope) {
threshhold = threshhold || 250;
var last, deferTimer;
return function () {
var context = scope || this;
var now = +new Date, args = arguments;
if (last && now < last + threshhold) {
clearTimeout(deferTimer);
deferTimer = setTimeout(function () {
last = now;
fn.apply(context, args);
}, threshhold);
}
else {
last = now;
fn.apply(context, args);
}
};
}
exports.throttle = throttle;

View File

@ -1,5 +1,5 @@
'use strict';
import Remarkable from 'remarkable';
import * as Remarkable from 'remarkable';
declare var Prism: any;
const md = new Remarkable({
@ -89,3 +89,27 @@ export function safePush(obj, prop, val) {
if (!obj[prop]) obj[prop] = [];
obj[prop].push(val);
}
// credits https://remysharp.com/2010/07/21/throttling-function-calls
export function throttle(fn, threshhold, scope) {
threshhold = threshhold || 250;
var last,
deferTimer;
return function () {
var context = scope || this;
var now = +new Date,
args = arguments;
if (last && now < last + threshhold) {
// hold on to it
clearTimeout(deferTimer);
deferTimer = setTimeout(function () {
last = now;
fn.apply(context, args);
}, threshhold);
} else {
last = now;
fn.apply(context, args);
}
};
}

View File

@ -117,3 +117,7 @@ export class EncodeURIComponentPipe implements PipeTransform {
return encodeURIComponent(value);
}
}
export const REDOC_PIPES = [
JsonPointerEscapePipe, MarkedPipe, SafePipe, PrismPipe, EncodeURIComponentPipe
];

31
lib/vendor.ts Normal file
View File

@ -0,0 +1,31 @@
import 'prismjs';
import 'prismjs/components/prism-actionscript.js';
import 'prismjs/components/prism-c.js';
import 'prismjs/components/prism-cpp.js';
import 'prismjs/components/prism-csharp.js';
import 'prismjs/components/prism-php.js';
import 'prismjs/components/prism-coffeescript.js';
import 'prismjs/components/prism-go.js';
import 'prismjs/components/prism-haskell.js';
import 'prismjs/components/prism-java.js';
import 'prismjs/components/prism-lua.js';
import 'prismjs/components/prism-matlab.js';
import 'prismjs/components/prism-perl.js';
import 'prismjs/components/prism-python.js';
import 'prismjs/components/prism-r.js';
import 'prismjs/components/prism-ruby.js';
import 'prismjs/components/prism-bash.js';
import 'prismjs/components/prism-swift.js';
import 'prismjs/components/prism-objectivec.js';
import 'prismjs/components/prism-scala.js';
import 'dropkickjs/build/css/dropkick.css';
import 'prismjs/themes/prism-dark.css';
import 'hint.css/hint.base.css';
import '@angular/common';
import '@angular/core';
import '@angular/platform-browser';
// RxJS
import 'rxjs/Rx';

16
manual-types/index.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
declare module "dropkickjs"
declare module "json-schema-ref-parser"
declare module "openapi-sampler"
declare module "remarkable"
declare module "scrollparent"
declare module "slugify"
declare module "url"
declare module "json-pointer";
declare module "*.css" {
const content: string;
export default content;
}
declare var LIB_VERSION: any;
declare var IS_PRODUCTION: any;

View File

@ -1,21 +1,30 @@
{
"name": "redoc",
"description": "Swagger-generated API Reference Documentation",
"version": "1.1.2",
"version": "1.2.0",
"repository": {
"type": "git",
"url": "git://github.com/Rebilly/ReDoc"
},
"main": "dist/redoc.min.js",
"scripts": {
"test": "gulp lint && node ./build/run_tests.js",
"jspm-install": "jspm install",
"start": "gulp serve",
"build-dist": "gulp build --prod",
"test": "npm run lint && node ./build/run_tests.js",
"branch-release": "git reset --hard && branch-release",
"unit": "gulp test",
"e2e": "gulp e2e --prod",
"deploy": "node ./build/prepare_deploy.js && deploy-to-gh-pages --update demo"
"lint": "tslint -e \"lib/**/*{ngfactory|css.shim}.ts\" lib/**/*.ts",
"unit": "npm run build:sass && karma start",
"e2e": "npm run build:prod && npm run e2e-copy && npm run webdriver && protractor",
"deploy": "node ./build/prepare_deploy.js && deploy-to-gh-pages --update demo",
"ngc": "ngc -p .",
"webpack:prod": "webpack --config build/webpack.prod.js --profile --bail",
"build:sass": "node-sass -q -o lib lib",
"build:prod": "npm run build:sass && npm run ngc && npm run webpack:prod",
"build-dist": "npm run build:prod",
"stats": "webpack --config build/webpack.prod.js --json > stats.json",
"start": "webpack-dev-server --config build/webpack.dev.js --content-base demo",
"e2e-server": "http-server -p 3000 tests/e2e",
"e2e-copy": "cp dist/redoc.min.js tests/e2e/",
"webdriver": "webdriver-manager update",
"serve:prod": "NODE_ENV=production npm start"
},
"keywords": [
"OpenAPI",
@ -29,118 +38,73 @@
],
"author": "Roman Hotsiy",
"license": "MIT",
"jspm": {
"configFile": "system.config.js",
"dependencies": {
"@angular/common@2.0.0-rc.4": "npm:@angular/common@2.0.0-rc.4",
"@angular/compiler@2.0.0-rc.4": "npm:@angular/compiler@2.0.0-rc.4",
"@angular/core@2.0.0-rc.4": "npm:@angular/core@2.0.0-rc.4",
"@angular/platform-browser-dynamic@2.0.0-rc.4": "npm:@angular/platform-browser-dynamic@2.0.0-rc.4",
"@angular/platform-browser@2.0.0-rc.4": "npm:@angular/platform-browser@2.0.0-rc.4",
"dropkickjs": "npm:dropkickjs@^2.1.8",
"es6-shim": "github:es-shims/es6-shim@^0.33.6",
"hint.css": "npm:hint.css@^2.2.1",
"json": "github:systemjs/plugin-json@^0.1.0",
"json-pointer": "npm:json-pointer@^0.3.0",
"json-schema-ref-parser": "npm:json-schema-ref-parser@^3.1.2",
"openapi-sampler": "npm:openapi-sampler@^0.3.0",
"prismjs": "npm:prismjs@^1.3.0",
"remarkable": "npm:remarkable@^1.6.2",
"rxjs": "npm:rxjs@5.0.0-beta.6",
"scrollparent": "npm:scrollparent@^0.1.0",
"slugify": "npm:slugify@^0.1.1",
"stream-http": "npm:stream-http@^2.3.0",
"url": "github:jspm/nodelibs-url@^0.1.0",
"zone.js": "npm:zone.js@0.6.12"
},
"devDependencies": {
"babel": "npm:babel-core@^5.8.34",
"babel-runtime": "npm:babel-runtime@^5.8.24",
"clean-css": "npm:clean-css@^3.4.17",
"core-js": "npm:core-js@^1.2.6",
"css": "github:systemjs/plugin-css@^0.1.18",
"systemjs/plugin-json": "github:systemjs/plugin-json@^0.1.0"
},
"overrides": {
"npm:dropkickjs@2.1.8": {
"format": "global"
},
"npm:json-schema-ref-parser@3.1.2": {
"map": {
"http": "stream-http",
"https": "stream-http"
}
},
"npm:openapi-sampler@0.3.0": {
"main": "src/openapi-sampler",
"format": "esm"
}
}
},
"devDependencies": {
"@angular/common": "^2.0.0-rc.4",
"@angular/compiler": "^2.0.0-rc.4",
"@angular/core": "^2.0.0-rc.4",
"@angular/platform-browser": "^2.0.0-rc.4",
"@angular/platform-browser-dynamic": "^2.0.0-rc.4",
"@angular/platform-server": "^2.0.0-rc.4",
"babel-polyfill": "^6.3.14",
"@types/core-js": "^0.9.31",
"@types/jasmine": "^2.2.32",
"@types/requirejs": "^2.1.26",
"@types/should": "^8.1.28",
"angular2-template-loader": "^0.5.0",
"awesome-typescript-loader": "^2.2.1",
"branch-release": "^1.0.3",
"browser-sync": "^2.10.1",
"codelyzer": "0.0.23",
"chalk": "^1.1.3",
"codelyzer": "0.0.28",
"copy-webpack-plugin": "^3.0.1",
"coveralls": "^2.11.9",
"del": "^2.2.0",
"css-loader": "^0.24.0",
"deploy-to-gh-pages": "^1.1.2",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-if": "^2.0.1",
"gulp-inline-ng2-template": "^2.0.4",
"gulp-protractor": "^2.1.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4",
"gulp-sass": "^2.1.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-tslint": "^5.0.0",
"isparta": "^4.0.0",
"istanbul": "github:gotwarlost/istanbul#source-map",
"http-server": "^0.9.0",
"istanbul-instrumenter-loader": "^0.2.0",
"jasmine-core": "^2.4.1",
"jasmine-spec-reporter": "^2.4.0",
"json-pointer": "^0.5.0",
"json-schema-ref-parser": "^3.1.2",
"jspm": "^0.16.36",
"karma": "^0.13.15",
"karma-babel-preprocessor": "^5.2.2",
"karma-chrome-launcher": "^1.0.1",
"karma-coverage": "github:douglasduteil/karma-coverage#next",
"karma-coveralls": "^1.1.2",
"karma-jasmine": "^1.0.2",
"karma-jspm": "^2.1.1",
"karma-mocha-reporter": "^2.0.0",
"karma-phantomjs-launcher": "^1.0.0",
"karma-phantomjs-shim": "^1.1.2",
"karma-regex-preprocessor": "github:makern/karma-regex-preprocessor",
"karma-should": "^1.0.0",
"karma-sinon": "^1.0.4",
"node-sass": "^3.7.0",
"openapi-sampler": "^0.2.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.8.0",
"node-sass": "^3.8.0",
"phantomjs-prebuilt": "^2.1.7",
"protractor": "^3.0.0",
"reflect-metadata": "^0.1.2",
"remap-istanbul": "^0.6.4",
"remarkable": "^1.6.2",
"require-dir": "^0.3.0",
"run-sequence": "^1.1.5",
"rxjs": "5.0.0-beta.6",
"scrollparent": "^1.0.0",
"protractor": "^3.3.0",
"raw-loader": "^0.5.1",
"shelljs": "^0.7.0",
"should": "^9.0.2",
"sinon": "^1.17.2",
"slugify": "^0.1.1",
"systemjs-builder": "^0.15.16",
"tslint": "^3.13.0",
"source-map-loader": "^0.1.5",
"style-loader": "^0.13.1",
"ts-helpers": "^1.1.1",
"tslint": "^3.15.0-dev.0",
"tslint-stylish": "^2.1.0-beta",
"typescript": "^1.8.10",
"vinyl-paths": "^2.0.0",
"yargs": "^4.7.1",
"zone.js": "^0.6.12"
"typescript": "^2.0.0",
"webpack": "^2.1.0-beta.21",
"webpack-dev-server": "^1.15.0",
"yargs": "^4.7.1"
},
"dependencies": {
"@angular/common": "^2.0.0-rc.5",
"@angular/compiler": "^2.0.0-rc.5",
"@angular/compiler-cli": "^0.5.0",
"@angular/core": "^2.0.0-rc.5",
"@angular/platform-browser": "^2.0.0-rc.5",
"@angular/platform-browser-dynamic": "^2.0.0-rc.5",
"@angular/platform-server": "^2.0.0-rc.5",
"core-js": "^2.4.1",
"dropkickjs": "^2.1.10",
"hint.css": "^2.3.2",
"json-pointer": "^0.5.0",
"json-schema-ref-parser": "^3.1.2",
"openapi-sampler": "^0.3.0",
"prismjs": "^1.5.1",
"remarkable": "^1.6.2",
"rxjs": "5.0.0-beta.6",
"scrollparent": "^1.0.0",
"slugify": "^0.1.1",
"stream-http": "^2.3.1",
"zone.js": "^0.6.15"
}
}

View File

@ -3,7 +3,7 @@ const loadJson = require('./tests/e2e/helpers').loadJson;
const travis = process.env.TRAVIS;
let config = {
specs: ['./tests/e2e/**/*.js'],
specs: ['./tests/e2e/**/*.e2e.js'],
baseUrl: 'http://localhost:3000',
framework: 'jasmine2',
onPrepare: function() {
@ -13,9 +13,8 @@ let config = {
// load APIs.guru list
return loadJson('https://api.apis.guru/v2/list.json').then((list) => {
global.apisGuruList = list;
return browser.getCapabilities().then(function (cap) {
browser.isIE = cap.browserName === 'internet explorer'
|| (cap.caps_ && cap.caps_.browserName === 'internet explorer')
return browser.getCapabilities().then(function (caps) {
browser.isIE = caps.get('browserName') === 'internet explorer';
});
});
},
@ -29,8 +28,8 @@ let config = {
print: function() {}
},
multiCapabilities: [
{ browserName: 'chrome' },
{ browserName: 'firefox' }
{ browserName: 'chrome' }
// { browserName: 'firefox' }
]
};

View File

@ -1,939 +0,0 @@
System.config({
baseURL: "/",
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"runtime",
"optimisation.modules.system",
"es7.decorators",
"es7.classProperties"
]
},
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
},
map: {
"@angular/common": "npm:@angular/common@2.0.0-rc.4",
"@angular/compiler": "npm:@angular/compiler@2.0.0-rc.4",
"@angular/core": "npm:@angular/core@2.0.0-rc.4",
"@angular/platform-browser": "npm:@angular/platform-browser@2.0.0-rc.4",
"@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@2.0.0-rc.4",
"babel": "npm:babel-core@5.8.34",
"babel-runtime": "npm:babel-runtime@5.8.34",
"clean-css": "npm:clean-css@3.4.17",
"core-js": "npm:core-js@1.2.6",
"css": "github:systemjs/plugin-css@0.1.18",
"dropkickjs": "npm:dropkickjs@2.1.8",
"es6-shim": "github:es-shims/es6-shim@0.33.6",
"hint.css": "npm:hint.css@2.2.1",
"json": "github:systemjs/plugin-json@0.1.2",
"json-formatter-js": "npm:json-formatter-js@0.2.0",
"json-pointer": "npm:json-pointer@0.3.0",
"json-schema-ref-parser": "npm:json-schema-ref-parser@3.1.2",
"openapi-sampler": "npm:openapi-sampler@0.3.0",
"prismjs": "npm:prismjs@1.3.0",
"remarkable": "npm:remarkable@1.6.2",
"rxjs": "npm:rxjs@5.0.0-beta.6",
"scrollparent": "npm:scrollparent@0.1.0",
"slugify": "npm:slugify@0.1.1",
"stream-http": "npm:stream-http@2.3.0",
"systemjs/plugin-json": "github:systemjs/plugin-json@0.1.2",
"url": "github:jspm/nodelibs-url@0.1.0",
"zone.js": "npm:zone.js@0.6.12",
"github:jspm/nodelibs-assert@0.1.0": {
"assert": "npm:assert@1.4.1"
},
"github:jspm/nodelibs-buffer@0.1.0": {
"buffer": "npm:buffer@3.6.0"
},
"github:jspm/nodelibs-constants@0.1.0": {
"constants-browserify": "npm:constants-browserify@0.0.1"
},
"github:jspm/nodelibs-crypto@0.1.0": {
"crypto-browserify": "npm:crypto-browserify@3.11.0"
},
"github:jspm/nodelibs-events@0.1.1": {
"events": "npm:events@1.0.2"
},
"github:jspm/nodelibs-http@1.7.1": {
"Base64": "npm:Base64@0.2.1",
"events": "github:jspm/nodelibs-events@0.1.1",
"inherits": "npm:inherits@2.0.1",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"url": "github:jspm/nodelibs-url@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"github:jspm/nodelibs-https@0.1.0": {
"https-browserify": "npm:https-browserify@0.0.0"
},
"github:jspm/nodelibs-net@0.1.2": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"http": "github:jspm/nodelibs-http@1.7.1",
"net": "github:jspm/nodelibs-net@0.1.2",
"process": "github:jspm/nodelibs-process@0.1.2",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"timers": "github:jspm/nodelibs-timers@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"github:jspm/nodelibs-os@0.1.0": {
"os-browserify": "npm:os-browserify@0.1.2"
},
"github:jspm/nodelibs-path@0.1.0": {
"path-browserify": "npm:path-browserify@0.0.0"
},
"github:jspm/nodelibs-process@0.1.2": {
"process": "npm:process@0.11.5"
},
"github:jspm/nodelibs-punycode@0.1.0": {
"punycode": "npm:punycode@1.3.2"
},
"github:jspm/nodelibs-querystring@0.1.0": {
"querystring": "npm:querystring@0.2.0"
},
"github:jspm/nodelibs-stream@0.1.0": {
"stream-browserify": "npm:stream-browserify@1.0.0"
},
"github:jspm/nodelibs-string_decoder@0.1.0": {
"string_decoder": "npm:string_decoder@0.10.31"
},
"github:jspm/nodelibs-timers@0.1.0": {
"timers-browserify": "npm:timers-browserify@1.4.2"
},
"github:jspm/nodelibs-tty@0.1.0": {
"tty-browserify": "npm:tty-browserify@0.0.0"
},
"github:jspm/nodelibs-url@0.1.0": {
"url": "npm:url@0.10.3"
},
"github:jspm/nodelibs-util@0.1.0": {
"util": "npm:util@0.10.3"
},
"github:jspm/nodelibs-vm@0.1.0": {
"vm-browserify": "npm:vm-browserify@0.0.4"
},
"github:jspm/nodelibs-zlib@0.1.0": {
"browserify-zlib": "npm:browserify-zlib@0.1.4"
},
"npm:@angular/common@2.0.0-rc.4": {
"@angular/core": "npm:@angular/core@2.0.0-rc.4",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:@angular/compiler@2.0.0-rc.4": {
"@angular/core": "npm:@angular/core@2.0.0-rc.4",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:@angular/core@2.0.0-rc.4": {
"process": "github:jspm/nodelibs-process@0.1.2",
"rxjs": "npm:rxjs@5.0.0-beta.6",
"zone.js": "npm:zone.js@0.6.12"
},
"npm:@angular/platform-browser-dynamic@2.0.0-rc.4": {
"@angular/common": "npm:@angular/common@2.0.0-rc.4",
"@angular/compiler": "npm:@angular/compiler@2.0.0-rc.4",
"@angular/core": "npm:@angular/core@2.0.0-rc.4",
"@angular/platform-browser": "npm:@angular/platform-browser@2.0.0-rc.4",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:@angular/platform-browser@2.0.0-rc.4": {
"@angular/common": "npm:@angular/common@2.0.0-rc.4",
"@angular/compiler": "npm:@angular/compiler@2.0.0-rc.4",
"@angular/core": "npm:@angular/core@2.0.0-rc.4",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:amdefine@1.0.0": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"module": "github:jspm/nodelibs-module@0.1.0",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:argparse@0.1.16": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"underscore": "npm:underscore@1.7.0",
"underscore.string": "npm:underscore.string@2.4.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:argparse@1.0.7": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"sprintf-js": "npm:sprintf-js@1.0.3",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:asn1.js@4.6.2": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"bn.js": "npm:bn.js@4.11.4",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"inherits": "npm:inherits@2.0.1",
"minimalistic-assert": "npm:minimalistic-assert@1.0.0",
"vm": "github:jspm/nodelibs-vm@0.1.0"
},
"npm:asn1@0.2.3": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"sys": "github:jspm/nodelibs-util@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:assert-plus@0.2.0": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:assert-plus@1.0.0": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:assert@1.4.1": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"util": "npm:util@0.10.3"
},
"npm:async@1.5.2": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:autolinker@0.15.3": {
"child_process": "github:jspm/nodelibs-child_process@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:aws-sign2@0.6.0": {
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"url": "github:jspm/nodelibs-url@0.1.0"
},
"npm:aws4@1.4.1": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"querystring": "github:jspm/nodelibs-querystring@0.1.0",
"url": "github:jspm/nodelibs-url@0.1.0"
},
"npm:babel-runtime@5.8.34": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:bl@1.1.2": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"readable-stream": "npm:readable-stream@2.0.6",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:bn.js@4.11.4": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0"
},
"npm:boom@2.10.1": {
"hoek": "npm:hoek@2.16.3",
"http": "github:jspm/nodelibs-http@1.7.1"
},
"npm:browserify-aes@1.0.6": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"buffer-xor": "npm:buffer-xor@1.0.3",
"cipher-base": "npm:cipher-base@1.0.2",
"create-hash": "npm:create-hash@1.1.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"evp_bytestokey": "npm:evp_bytestokey@1.0.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"inherits": "npm:inherits@2.0.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:browserify-cipher@1.0.0": {
"browserify-aes": "npm:browserify-aes@1.0.6",
"browserify-des": "npm:browserify-des@1.0.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"evp_bytestokey": "npm:evp_bytestokey@1.0.0"
},
"npm:browserify-des@1.0.0": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"cipher-base": "npm:cipher-base@1.0.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"des.js": "npm:des.js@1.0.0",
"inherits": "npm:inherits@2.0.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:browserify-rsa@4.0.1": {
"bn.js": "npm:bn.js@4.11.4",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"constants": "github:jspm/nodelibs-constants@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"randombytes": "npm:randombytes@2.0.3",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:browserify-sign@4.0.0": {
"bn.js": "npm:bn.js@4.11.4",
"browserify-rsa": "npm:browserify-rsa@4.0.1",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"create-hmac": "npm:create-hmac@1.1.4",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"elliptic": "npm:elliptic@6.3.1",
"inherits": "npm:inherits@2.0.1",
"parse-asn1": "npm:parse-asn1@5.0.0",
"stream": "github:jspm/nodelibs-stream@0.1.0"
},
"npm:browserify-zlib@0.1.4": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"pako": "npm:pako@0.2.8",
"process": "github:jspm/nodelibs-process@0.1.2",
"readable-stream": "npm:readable-stream@2.0.6",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:buffer-xor@1.0.3": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:buffer@3.6.0": {
"base64-js": "npm:base64-js@0.0.8",
"child_process": "github:jspm/nodelibs-child_process@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"ieee754": "npm:ieee754@1.1.6",
"isarray": "npm:isarray@1.0.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:builtin-status-codes@2.0.0": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"http": "github:jspm/nodelibs-http@1.7.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:call-me-maybe@1.0.1": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:caseless@0.11.0": {
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:chalk@1.1.3": {
"ansi-styles": "npm:ansi-styles@2.2.1",
"escape-string-regexp": "npm:escape-string-regexp@1.0.5",
"has-ansi": "npm:has-ansi@2.0.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"strip-ansi": "npm:strip-ansi@3.0.1",
"supports-color": "npm:supports-color@2.0.0"
},
"npm:cipher-base@1.0.2": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"inherits": "npm:inherits@2.0.1",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"string_decoder": "github:jspm/nodelibs-string_decoder@0.1.0",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:clean-css@3.4.17": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"commander": "npm:commander@2.8.1",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"http": "github:jspm/nodelibs-http@1.7.1",
"https": "github:jspm/nodelibs-https@0.1.0",
"os": "github:jspm/nodelibs-os@0.1.0",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"source-map": "npm:source-map@0.4.4",
"url": "github:jspm/nodelibs-url@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:combined-stream@1.0.5": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"delayed-stream": "npm:delayed-stream@1.0.0",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:commander@2.8.1": {
"child_process": "github:jspm/nodelibs-child_process@0.1.0",
"events": "github:jspm/nodelibs-events@0.1.1",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"graceful-readlink": "npm:graceful-readlink@1.0.1",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:commander@2.9.0": {
"child_process": "github:jspm/nodelibs-child_process@0.1.0",
"events": "github:jspm/nodelibs-events@0.1.1",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"graceful-readlink": "npm:graceful-readlink@1.0.1",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:constants-browserify@0.0.1": {
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:core-js@1.2.6": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:core-util-is@1.0.2": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0"
},
"npm:create-ecdh@4.0.0": {
"bn.js": "npm:bn.js@4.11.4",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"elliptic": "npm:elliptic@6.3.1"
},
"npm:create-hash@1.1.2": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"cipher-base": "npm:cipher-base@1.0.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"inherits": "npm:inherits@2.0.1",
"ripemd160": "npm:ripemd160@1.0.1",
"sha.js": "npm:sha.js@2.4.5"
},
"npm:create-hmac@1.1.4": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"inherits": "npm:inherits@2.0.1",
"stream": "github:jspm/nodelibs-stream@0.1.0"
},
"npm:cryptiles@2.0.5": {
"boom": "npm:boom@2.10.1",
"crypto": "github:jspm/nodelibs-crypto@0.1.0"
},
"npm:crypto-browserify@3.11.0": {
"browserify-cipher": "npm:browserify-cipher@1.0.0",
"browserify-sign": "npm:browserify-sign@4.0.0",
"create-ecdh": "npm:create-ecdh@4.0.0",
"create-hash": "npm:create-hash@1.1.2",
"create-hmac": "npm:create-hmac@1.1.4",
"diffie-hellman": "npm:diffie-hellman@5.0.2",
"inherits": "npm:inherits@2.0.1",
"pbkdf2": "npm:pbkdf2@3.0.4",
"public-encrypt": "npm:public-encrypt@4.0.0",
"randombytes": "npm:randombytes@2.0.3",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:dashdash@1.14.0": {
"assert-plus": "npm:assert-plus@1.0.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:debug@2.2.0": {
"ms": "npm:ms@0.7.1"
},
"npm:delayed-stream@1.0.0": {
"stream": "github:jspm/nodelibs-stream@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:des.js@1.0.0": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"inherits": "npm:inherits@2.0.1",
"minimalistic-assert": "npm:minimalistic-assert@1.0.0"
},
"npm:diffie-hellman@5.0.2": {
"bn.js": "npm:bn.js@4.11.4",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"miller-rabin": "npm:miller-rabin@4.0.0",
"randombytes": "npm:randombytes@2.0.3",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:dropkickjs@2.1.8": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:ecc-jsbn@0.1.1": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"jsbn": "npm:jsbn@0.1.0"
},
"npm:elliptic@6.3.1": {
"bn.js": "npm:bn.js@4.11.4",
"brorand": "npm:brorand@1.0.5",
"hash.js": "npm:hash.js@1.0.3",
"inherits": "npm:inherits@2.0.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:es6-promise@3.2.1": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:evp_bytestokey@1.0.0": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:extsprintf@1.0.2": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:forever-agent@0.6.1": {
"http": "github:jspm/nodelibs-http@1.7.1",
"https": "github:jspm/nodelibs-https@0.1.0",
"net": "github:jspm/nodelibs-net@0.1.2",
"tls": "github:jspm/nodelibs-tls@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:form-data@1.0.0-rc4": {
"async": "npm:async@1.5.2",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"combined-stream": "npm:combined-stream@1.0.5",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"http": "github:jspm/nodelibs-http@1.7.1",
"https": "github:jspm/nodelibs-https@0.1.0",
"mime-types": "npm:mime-types@2.1.11",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"url": "github:jspm/nodelibs-url@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:generate-function@2.0.0": {
"systemjs-json": "github:systemjs/plugin-json@0.1.2",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:generate-object-property@1.2.0": {
"is-property": "npm:is-property@1.0.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:getpass@0.1.6": {
"assert-plus": "npm:assert-plus@1.0.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"process": "github:jspm/nodelibs-process@0.1.2",
"tty": "github:jspm/nodelibs-tty@0.1.0"
},
"npm:graceful-readlink@1.0.1": {
"fs": "github:jspm/nodelibs-fs@0.1.2"
},
"npm:har-validator@2.0.6": {
"chalk": "npm:chalk@1.1.3",
"commander": "npm:commander@2.9.0",
"is-my-json-valid": "npm:is-my-json-valid@2.13.1",
"pinkie-promise": "npm:pinkie-promise@2.0.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:has-ansi@2.0.0": {
"ansi-regex": "npm:ansi-regex@2.0.0"
},
"npm:hash.js@1.0.3": {
"inherits": "npm:inherits@2.0.1"
},
"npm:hawk@3.1.3": {
"boom": "npm:boom@2.10.1",
"cryptiles": "npm:cryptiles@2.0.5",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"hoek": "npm:hoek@2.16.3",
"process": "github:jspm/nodelibs-process@0.1.2",
"sntp": "npm:sntp@1.0.9",
"systemjs-json": "github:systemjs/plugin-json@0.1.2",
"url": "github:jspm/nodelibs-url@0.1.0"
},
"npm:hoek@2.16.3": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:http-signature@1.1.1": {
"assert-plus": "npm:assert-plus@0.2.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"http": "github:jspm/nodelibs-http@1.7.1",
"jsprim": "npm:jsprim@1.2.2",
"sshpk": "npm:sshpk@1.8.3",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:https-browserify@0.0.0": {
"http": "github:jspm/nodelibs-http@1.7.1"
},
"npm:inherits@2.0.1": {
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:is-my-json-valid@2.13.1": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"generate-function": "npm:generate-function@2.0.0",
"generate-object-property": "npm:generate-object-property@1.2.0",
"jsonpointer": "npm:jsonpointer@2.0.0",
"path": "github:jspm/nodelibs-path@0.1.0",
"systemjs-json": "github:systemjs/plugin-json@0.1.2",
"xtend": "npm:xtend@4.0.1"
},
"npm:is-typedarray@1.0.0": {
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:isarray@1.0.0": {
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:isstream@0.1.2": {
"events": "github:jspm/nodelibs-events@0.1.1",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"systemjs-json": "github:systemjs/plugin-json@0.1.2",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:jodid25519@1.0.2": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"jsbn": "npm:jsbn@0.1.0"
},
"npm:js-yaml@3.6.1": {
"argparse": "npm:argparse@1.0.7",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"esprima": "npm:esprima@2.7.2",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:jsbn@0.1.0": {
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:json-formatter-js@0.2.0": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:json-pointer@0.3.0": {
"foreach": "npm:foreach@2.0.5"
},
"npm:json-schema-ref-parser@3.1.2": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"call-me-maybe": "npm:call-me-maybe@1.0.1",
"debug": "npm:debug@2.2.0",
"es6-promise": "npm:es6-promise@3.2.1",
"events": "github:jspm/nodelibs-events@0.1.1",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"js-yaml": "npm:js-yaml@3.6.1",
"ono": "npm:ono@2.2.1",
"process": "github:jspm/nodelibs-process@0.1.2",
"punycode": "github:jspm/nodelibs-punycode@0.1.0",
"querystring": "github:jspm/nodelibs-querystring@0.1.0",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"string_decoder": "github:jspm/nodelibs-string_decoder@0.1.0",
"url": "github:jspm/nodelibs-url@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0",
"z-schema": "npm:z-schema@3.17.0"
},
"npm:jsonpointer@2.0.0": {
"assert": "github:jspm/nodelibs-assert@0.1.0"
},
"npm:jsprim@1.2.2": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"extsprintf": "npm:extsprintf@1.0.2",
"json-schema": "npm:json-schema@0.2.2",
"process": "github:jspm/nodelibs-process@0.1.2",
"util": "github:jspm/nodelibs-util@0.1.0",
"verror": "npm:verror@1.3.6"
},
"npm:lodash._basetostring@4.12.0": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:lodash._stringtopath@4.8.0": {
"lodash._basetostring": "npm:lodash._basetostring@4.12.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:lodash.get@4.3.0": {
"lodash._stringtopath": "npm:lodash._stringtopath@4.8.0"
},
"npm:miller-rabin@4.0.0": {
"bn.js": "npm:bn.js@4.11.4",
"brorand": "npm:brorand@1.0.5"
},
"npm:mime-db@1.23.0": {
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:mime-types@2.1.11": {
"mime-db": "npm:mime-db@1.23.0",
"path": "github:jspm/nodelibs-path@0.1.0"
},
"npm:node-uuid@1.4.7": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0"
},
"npm:oauth-sign@0.8.2": {
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"querystring": "github:jspm/nodelibs-querystring@0.1.0"
},
"npm:ono@2.2.1": {
"process": "github:jspm/nodelibs-process@0.1.2",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:os-browserify@0.1.2": {
"os": "github:jspm/nodelibs-os@0.1.0"
},
"npm:pako@0.2.8": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:parse-asn1@5.0.0": {
"asn1.js": "npm:asn1.js@4.6.2",
"browserify-aes": "npm:browserify-aes@1.0.6",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"evp_bytestokey": "npm:evp_bytestokey@1.0.0",
"pbkdf2": "npm:pbkdf2@3.0.4",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:path-browserify@0.0.0": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:pbkdf2@3.0.4": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"child_process": "github:jspm/nodelibs-child_process@0.1.0",
"create-hmac": "npm:create-hmac@1.1.4",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:pinkie-promise@2.0.1": {
"pinkie": "npm:pinkie@2.0.4"
},
"npm:prismjs@1.3.0": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:process-nextick-args@1.0.6": {
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:process-nextick-args@1.0.7": {
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:process@0.11.5": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"vm": "github:jspm/nodelibs-vm@0.1.0"
},
"npm:public-encrypt@4.0.0": {
"bn.js": "npm:bn.js@4.11.4",
"browserify-rsa": "npm:browserify-rsa@4.0.1",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"parse-asn1": "npm:parse-asn1@5.0.0",
"randombytes": "npm:randombytes@2.0.3"
},
"npm:punycode@1.3.2": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:randombytes@2.0.3": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:readable-stream@1.1.14": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"core-util-is": "npm:core-util-is@1.0.2",
"events": "github:jspm/nodelibs-events@0.1.1",
"inherits": "npm:inherits@2.0.1",
"isarray": "npm:isarray@0.0.1",
"process": "github:jspm/nodelibs-process@0.1.2",
"stream-browserify": "npm:stream-browserify@1.0.0",
"string_decoder": "npm:string_decoder@0.10.31"
},
"npm:readable-stream@2.0.6": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"core-util-is": "npm:core-util-is@1.0.2",
"events": "github:jspm/nodelibs-events@0.1.1",
"inherits": "npm:inherits@2.0.1",
"isarray": "npm:isarray@1.0.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"process-nextick-args": "npm:process-nextick-args@1.0.7",
"string_decoder": "npm:string_decoder@0.10.31",
"util-deprecate": "npm:util-deprecate@1.0.2"
},
"npm:readable-stream@2.1.2": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"core-util-is": "npm:core-util-is@1.0.2",
"events": "github:jspm/nodelibs-events@0.1.1",
"inherits": "npm:inherits@2.0.1",
"isarray": "npm:isarray@1.0.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"process-nextick-args": "npm:process-nextick-args@1.0.6",
"string_decoder": "npm:string_decoder@0.10.31",
"util-deprecate": "npm:util-deprecate@1.0.2"
},
"npm:remarkable@1.6.2": {
"argparse": "npm:argparse@0.1.16",
"autolinker": "npm:autolinker@0.15.3",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.2",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:request@2.72.0": {
"aws-sign2": "npm:aws-sign2@0.6.0",
"aws4": "npm:aws4@1.4.1",
"bl": "npm:bl@1.1.2",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"caseless": "npm:caseless@0.11.0",
"combined-stream": "npm:combined-stream@1.0.5",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"extend": "npm:extend@3.0.0",
"forever-agent": "npm:forever-agent@0.6.1",
"form-data": "npm:form-data@1.0.0-rc4",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"har-validator": "npm:har-validator@2.0.6",
"hawk": "npm:hawk@3.1.3",
"http": "github:jspm/nodelibs-http@1.7.1",
"http-signature": "npm:http-signature@1.1.1",
"https": "github:jspm/nodelibs-https@0.1.0",
"is-typedarray": "npm:is-typedarray@1.0.0",
"isstream": "npm:isstream@0.1.2",
"json-stringify-safe": "npm:json-stringify-safe@5.0.1",
"mime-types": "npm:mime-types@2.1.11",
"node-uuid": "npm:node-uuid@1.4.7",
"oauth-sign": "npm:oauth-sign@0.8.2",
"process": "github:jspm/nodelibs-process@0.1.2",
"qs": "npm:qs@6.1.0",
"querystring": "github:jspm/nodelibs-querystring@0.1.0",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"stringstream": "npm:stringstream@0.0.5",
"tough-cookie": "npm:tough-cookie@2.2.2",
"tunnel-agent": "npm:tunnel-agent@0.4.3",
"url": "github:jspm/nodelibs-url@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0",
"zlib": "github:jspm/nodelibs-zlib@0.1.0"
},
"npm:ripemd160@1.0.1": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:rxjs@5.0.0-beta.6": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:sha.js@2.4.5": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:sntp@1.0.9": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"dgram": "github:jspm/nodelibs-dgram@0.1.0",
"dns": "github:jspm/nodelibs-dns@0.1.0",
"hoek": "npm:hoek@2.16.3",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:source-map@0.4.4": {
"amdefine": "npm:amdefine@1.0.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:sshpk@1.8.3": {
"asn1": "npm:asn1@0.2.3",
"assert-plus": "npm:assert-plus@1.0.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"dashdash": "npm:dashdash@1.14.0",
"ecc-jsbn": "npm:ecc-jsbn@0.1.1",
"getpass": "npm:getpass@0.1.6",
"jodid25519": "npm:jodid25519@1.0.2",
"jsbn": "npm:jsbn@0.1.0",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"tweetnacl": "npm:tweetnacl@0.13.3",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:stream-browserify@1.0.0": {
"events": "github:jspm/nodelibs-events@0.1.1",
"inherits": "npm:inherits@2.0.1",
"readable-stream": "npm:readable-stream@1.1.14"
},
"npm:stream-http@2.3.0": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"builtin-status-codes": "npm:builtin-status-codes@2.0.0",
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@0.1.2",
"readable-stream": "npm:readable-stream@2.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.2",
"to-arraybuffer": "npm:to-arraybuffer@1.0.1",
"url": "github:jspm/nodelibs-url@0.1.0",
"xtend": "npm:xtend@4.0.1"
},
"npm:string_decoder@0.10.31": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0"
},
"npm:stringstream@0.0.5": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"process": "github:jspm/nodelibs-process@0.1.2",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"string_decoder": "github:jspm/nodelibs-string_decoder@0.1.0",
"systemjs-json": "github:systemjs/plugin-json@0.1.2",
"util": "github:jspm/nodelibs-util@0.1.0",
"zlib": "github:jspm/nodelibs-zlib@0.1.0"
},
"npm:strip-ansi@3.0.1": {
"ansi-regex": "npm:ansi-regex@2.0.0"
},
"npm:supports-color@2.0.0": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:timers-browserify@1.4.2": {
"process": "npm:process@0.11.5"
},
"npm:to-arraybuffer@1.0.1": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:tough-cookie@2.2.2": {
"net": "github:jspm/nodelibs-net@0.1.2",
"punycode": "github:jspm/nodelibs-punycode@0.1.0",
"systemjs-json": "github:systemjs/plugin-json@0.1.2",
"url": "github:jspm/nodelibs-url@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:tunnel-agent@0.4.3": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"events": "github:jspm/nodelibs-events@0.1.1",
"http": "github:jspm/nodelibs-http@1.7.1",
"https": "github:jspm/nodelibs-https@0.1.0",
"net": "github:jspm/nodelibs-net@0.1.2",
"process": "github:jspm/nodelibs-process@0.1.2",
"tls": "github:jspm/nodelibs-tls@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:url@0.10.3": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"punycode": "npm:punycode@1.3.2",
"querystring": "npm:querystring@0.2.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:util-deprecate@1.0.2": {
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:util@0.10.3": {
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:verror@1.3.6": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"extsprintf": "npm:extsprintf@1.0.2",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:vm-browserify@0.0.4": {
"indexof": "npm:indexof@0.0.1"
},
"npm:xtend@4.0.1": {
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:z-schema@3.17.0": {
"commander": "npm:commander@2.9.0",
"lodash.get": "npm:lodash.get@4.3.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"request": "npm:request@2.72.0",
"systemjs-json": "github:systemjs/plugin-json@0.1.2",
"validator": "npm:validator@5.4.0"
},
"npm:zone.js@0.6.12": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2"
}
}
});

View File

@ -1,12 +0,0 @@
{
"parser": "babel-eslint",
"extends": "eslint:recommended",
"env": {
"node": true,
"jasmine": true,
"protractor": true
},
"rules": {
"no-console": 0,
}
}

1
tests/e2e/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
redoc.min.js

View File

@ -48,6 +48,11 @@ function verifyNoBrowserErrors() {
if (message.indexOf('browser-sync') > -1) return false;
// skip firefox-specific warning
if (message.indexOf('mutating the [[Prototype]]') > -1) return false;
if (message.match(/^Unknown property.*Declaration dropped/)) return false;
if (message.match(/^Error in parsing value for.*Declaration dropped/)) return false;
if (message.indexOf('The character encoding of the HTML document was not declared') > -1) return false;
if (message.match(/addons.manager\s+DEBUG/)) return false;
if (logEntry.level.value >= LogLevel.INFO) {
if (message.length > MAX_ERROR_MESSAGE_SYMBOLS) {

View File

@ -10,7 +10,7 @@
</redoc>
<!-- ReDoc built file with all dependencies included -->
<script src="dist/redoc.min.js"> </script>
<script src="redoc.min.js"> </script>
<script>
window.redocError = null;
/* init redoc */

View File

@ -1,25 +0,0 @@
'use strict';
import {setBaseTestProviders} from '@angular/core/testing';
import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter';
import { OptionsService, RedocEventsService, Hash, ScrollService, MenuService } from '../lib/services/index';
import { SpecManager } from '../lib/utils/SpecManager';
import { provide } from '@angular/core';
import {
TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
} from '@angular/platform-browser-dynamic/testing';
setBaseTestProviders(
[
TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
provide(BrowserDomAdapter, {useClass: BrowserDomAdapter}),
provide(OptionsService, {useClass: OptionsService}),
provide(RedocEventsService, {useClass: RedocEventsService}),
provide(SpecManager, {useClass: SpecManager}),
provide(Hash, {useClass: Hash}),
provide(ScrollService, {useClass: ScrollService}),
provide(MenuService, {useClass: MenuService})
],
[TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS]);

66
tests/spec-bundle.js Normal file
View File

@ -0,0 +1,66 @@
'use strict';
Error.stackTraceLimit = Infinity;
require('core-js/es6');
require('core-js/es7/reflect');
// Typescript emit helpers polyfill
require('ts-helpers');
require('zone.js/dist/zone');
require('zone.js/dist/long-stack-trace-zone');
require('zone.js/dist/async-test');
require('zone.js/dist/fake-async-test');
require('zone.js/dist/sync-test');
require('zone.js/dist/proxy');
require('zone.js/dist/jasmine-patch');
require('../lib/vendor');
var TestBed = require('@angular/core/testing').TestBed;
var BrowserDynamicTestingModule = require('@angular/platform-browser-dynamic/testing').BrowserDynamicTestingModule;
var platformBrowserDynamicTesting = require('@angular/platform-browser-dynamic/testing').platformBrowserDynamicTesting;
var services = require('../lib/services/index');
var SpecManager = require('../lib/utils/SpecManager').SpecManager;
var BrowserDomAdapter = require('@angular/platform-browser/src/browser/browser_adapter').BrowserDomAdapter;
var REDOC_PIPES = require('../lib/utils/pipes').REDOC_PIPES;
var REDOC_COMMON_DIRECTIVES = require('../lib/shared/components/index').REDOC_COMMON_DIRECTIVES;
var REDOC_DIRECTIVES = require('../lib/components/index').REDOC_DIRECTIVES;
TestBed.initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
beforeEach(function() {
TestBed.configureTestingModule({
providers: [
BrowserDomAdapter,
SpecManager,
BrowserDomAdapter,
services.RedocEventsService,
services.ScrollService,
services.Hash,
services.MenuService,
services.WarningsService,
services.OptionsService
],
declarations: [REDOC_PIPES, REDOC_DIRECTIVES, REDOC_COMMON_DIRECTIVES]
});
});
var testContext = require.context('..', true, /\.spec\.ts/);
/*
* get all the files, for each file, call the context function
* that will require( the file and load it up here. Context wil);
* loop and require those spec files here
*/
function requireAll(requireContext) {
return requireContext.keys().map(requireContext);
}
// requires and returns all modules that match
var modules = requireAll(testContext);

View File

@ -114,7 +114,7 @@ describe('Utils', () => {
});
describe('getMethodParams method', () => {
beforeAll((done) => {
beforeAll((done:any) => {
specMgr.load('/tests/schemas/schema-mgr-methodparams.json').then(() => {
done();
}, () => {
@ -163,7 +163,7 @@ describe('Utils', () => {
});
describe('findDerivedDefinitions method', () => {
beforeAll((done) => {
beforeAll((done:any) => {
specMgr.load('/tests/schemas/extended-petstore.yml').then(() => {
done();
}, () => {
@ -176,8 +176,8 @@ describe('Utils', () => {
deriveDefs.should.be.instanceof(Array);
deriveDefs.should.not.be.empty();
deriveDefs.should.be.deepEqual([
{name: 'Cat', empty: false, $ref: '#/definitions/Cat'},
{name: 'Dog', empty: false, $ref: '#/definitions/Dog'}
{name: 'Cat', $ref: '#/definitions/Cat'},
{name: 'Dog', $ref: '#/definitions/Dog'}
]);
});

View File

@ -3,19 +3,28 @@
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"module": "es6",
"target": "es6",
"target": "es5",
"noImplicitAny": false,
"sourceMap": true,
"outDir": ".tmp/",
"moduleResolution": "node"
"outDir": ".tmp/lib",
"pretty": true,
"moduleResolution": "node",
"types": [
"core-js",
"jasmine",
"should",
"requirejs"
],
"noEmitHelpers": true
},
"compileOnSave": false,
"exclude": [
"node_modules",
"jspm_packages",
".tmp",
"build",
"docs",
"*.spec.js",
"lib/index.js"
]
".tmp"
],
"awesomeTypescriptLoaderOptions": {
"resolveGlobs": true,
"forkChecker": true
}
}

View File

@ -1,12 +0,0 @@
{
"globalDevDependencies": {
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446"
},
"globalDependencies": {
"marked": "registry:dt/marked#0.0.0+20160325085301",
"should": "registry:dt/should#8.1.1+20160521152556"
},
"ambientDevDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2"
}
}

View File

@ -1,4 +0,0 @@
declare module "dropkickjs" {
var x: any;
export default x;
}

View File

@ -1,501 +0,0 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/36a1be34dbe202c665b3ddafd50824f78c09eea3/jasmine/jasmine.d.ts
declare function describe(description: string, specDefinitions: () => void): void;
declare function fdescribe(description: string, specDefinitions: () => void): void;
declare function xdescribe(description: string, specDefinitions: () => void): void;
declare function it(expectation: string, assertion?: () => void, timeout?: number): void;
declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void;
declare function fit(expectation: string, assertion?: () => void, timeout?: number): void;
declare function fit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void;
declare function xit(expectation: string, assertion?: () => void, timeout?: number): void;
declare function xit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void;
/** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */
declare function pending(reason?: string): void;
declare function beforeEach(action: () => void, timeout?: number): void;
declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void;
declare function afterEach(action: () => void, timeout?: number): void;
declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void;
declare function beforeAll(action: () => void, timeout?: number): void;
declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void;
declare function afterAll(action: () => void, timeout?: number): void;
declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void;
declare function expect(spy: Function): jasmine.Matchers;
declare function expect(actual: any): jasmine.Matchers;
declare function fail(e?: any): void;
/** Action method that should be called when the async work is complete */
interface DoneFn extends Function {
(): void;
/** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */
fail: (message?: Error|string) => void;
}
declare function spyOn(object: any, method: string): jasmine.Spy;
declare function runs(asyncMethod: Function): void;
declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void;
declare function waits(timeout?: number): void;
declare namespace jasmine {
var clock: () => Clock;
function any(aclass: any): Any;
function anything(): Any;
function arrayContaining(sample: any[]): ArrayContaining;
function objectContaining(sample: any): ObjectContaining;
function createSpy(name: string, originalFn?: Function): Spy;
function createSpyObj(baseName: string, methodNames: any[]): any;
function createSpyObj<T>(baseName: string, methodNames: any[]): T;
function pp(value: any): string;
function getEnv(): Env;
function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
function addMatchers(matchers: CustomMatcherFactories): void;
function stringMatching(str: string): Any;
function stringMatching(str: RegExp): Any;
interface Any {
new (expectedClass: any): any;
jasmineMatches(other: any): boolean;
jasmineToString(): string;
}
// taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains()
interface ArrayLike<T> {
length: number;
[n: number]: T;
}
interface ArrayContaining {
new (sample: any[]): any;
asymmetricMatch(other: any): boolean;
jasmineToString(): string;
}
interface ObjectContaining {
new (sample: any): any;
jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean;
jasmineToString(): string;
}
interface Block {
new (env: Env, func: SpecFunction, spec: Spec): any;
execute(onComplete: () => void): void;
}
interface WaitsBlock extends Block {
new (env: Env, timeout: number, spec: Spec): any;
}
interface WaitsForBlock extends Block {
new (env: Env, timeout: number, latchFunction: SpecFunction, message: string, spec: Spec): any;
}
interface Clock {
install(): void;
uninstall(): void;
/** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */
tick(ms: number): void;
mockDate(date?: Date): void;
}
interface CustomEqualityTester {
(first: any, second: any): boolean;
}
interface CustomMatcher {
compare<T>(actual: T, expected: T): CustomMatcherResult;
compare(actual: any, expected: any): CustomMatcherResult;
}
interface CustomMatcherFactory {
(util: MatchersUtil, customEqualityTesters: Array<CustomEqualityTester>): CustomMatcher;
}
interface CustomMatcherFactories {
[index: string]: CustomMatcherFactory;
}
interface CustomMatcherResult {
pass: boolean;
message?: string;
}
interface MatchersUtil {
equals(a: any, b: any, customTesters?: Array<CustomEqualityTester>): boolean;
contains<T>(haystack: ArrayLike<T> | string, needle: any, customTesters?: Array<CustomEqualityTester>): boolean;
buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array<any>): string;
}
interface Env {
setTimeout: any;
clearTimeout: void;
setInterval: any;
clearInterval: void;
updateInterval: number;
currentSpec: Spec;
matchersClass: Matchers;
version(): any;
versionString(): string;
nextSpecId(): number;
addReporter(reporter: Reporter): void;
execute(): void;
describe(description: string, specDefinitions: () => void): Suite;
// ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these
beforeEach(beforeEachFunction: () => void): void;
beforeAll(beforeAllFunction: () => void): void;
currentRunner(): Runner;
afterEach(afterEachFunction: () => void): void;
afterAll(afterAllFunction: () => void): void;
xdescribe(desc: string, specDefinitions: () => void): XSuite;
it(description: string, func: () => void): Spec;
// iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these
xit(desc: string, func: () => void): XSpec;
compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean;
compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
contains_(haystack: any, needle: any): boolean;
addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
addMatchers(matchers: CustomMatcherFactories): void;
specFilter(spec: Spec): boolean;
}
interface FakeTimer {
new (): any;
reset(): void;
tick(millis: number): void;
runFunctionsWithinRange(oldMillis: number, nowMillis: number): void;
scheduleFunction(timeoutKey: any, funcToCall: () => void, millis: number, recurring: boolean): void;
}
interface HtmlReporter {
new (): any;
}
interface HtmlSpecFilter {
new (): any;
}
interface Result {
type: string;
}
interface NestedResults extends Result {
description: string;
totalCount: number;
passedCount: number;
failedCount: number;
skipped: boolean;
rollupCounts(result: NestedResults): void;
log(values: any): void;
getItems(): Result[];
addResult(result: Result): void;
passed(): boolean;
}
interface MessageResult extends Result {
values: any;
trace: Trace;
}
interface ExpectationResult extends Result {
matcherName: string;
passed(): boolean;
expected: any;
actual: any;
message: string;
trace: Trace;
}
interface Trace {
name: string;
message: string;
stack: any;
}
interface PrettyPrinter {
new (): any;
format(value: any): void;
iterateObject(obj: any, fn: (property: string, isGetter: boolean) => void): void;
emitScalar(value: any): void;
emitString(value: string): void;
emitArray(array: any[]): void;
emitObject(obj: any): void;
append(value: any): void;
}
interface StringPrettyPrinter extends PrettyPrinter {
}
interface Queue {
new (env: any): any;
env: Env;
ensured: boolean[];
blocks: Block[];
running: boolean;
index: number;
offset: number;
abort: boolean;
addBefore(block: Block, ensure?: boolean): void;
add(block: any, ensure?: boolean): void;
insertNext(block: any, ensure?: boolean): void;
start(onComplete?: () => void): void;
isRunning(): boolean;
next_(): void;
results(): NestedResults;
}
interface Matchers {
new (env: Env, actual: any, spec: Env, isNot?: boolean): any;
env: Env;
actual: any;
spec: Env;
isNot?: boolean;
message(): any;
toBe(expected: any, expectationFailOutput?: any): boolean;
toEqual(expected: any, expectationFailOutput?: any): boolean;
toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean;
toBeDefined(expectationFailOutput?: any): boolean;
toBeUndefined(expectationFailOutput?: any): boolean;
toBeNull(expectationFailOutput?: any): boolean;
toBeNaN(): boolean;
toBeTruthy(expectationFailOutput?: any): boolean;
toBeFalsy(expectationFailOutput?: any): boolean;
toHaveBeenCalled(): boolean;
toHaveBeenCalledWith(...params: any[]): boolean;
toHaveBeenCalledTimes(expected: number): boolean;
toContain(expected: any, expectationFailOutput?: any): boolean;
toBeLessThan(expected: number, expectationFailOutput?: any): boolean;
toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean;
toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean;
toThrow(expected?: any): boolean;
toThrowError(message?: string | RegExp): boolean;
toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean;
not: Matchers;
Any: Any;
}
interface Reporter {
reportRunnerStarting(runner: Runner): void;
reportRunnerResults(runner: Runner): void;
reportSuiteResults(suite: Suite): void;
reportSpecStarting(spec: Spec): void;
reportSpecResults(spec: Spec): void;
log(str: string): void;
}
interface MultiReporter extends Reporter {
addReporter(reporter: Reporter): void;
}
interface Runner {
new (env: Env): any;
execute(): void;
beforeEach(beforeEachFunction: SpecFunction): void;
afterEach(afterEachFunction: SpecFunction): void;
beforeAll(beforeAllFunction: SpecFunction): void;
afterAll(afterAllFunction: SpecFunction): void;
finishCallback(): void;
addSuite(suite: Suite): void;
add(block: Block): void;
specs(): Spec[];
suites(): Suite[];
topLevelSuites(): Suite[];
results(): NestedResults;
}
interface SpecFunction {
(spec?: Spec): void;
}
interface SuiteOrSpec {
id: number;
env: Env;
description: string;
queue: Queue;
}
interface Spec extends SuiteOrSpec {
new (env: Env, suite: Suite, description: string): any;
suite: Suite;
afterCallbacks: SpecFunction[];
spies_: Spy[];
results_: NestedResults;
matchersClass: Matchers;
getFullName(): string;
results(): NestedResults;
log(arguments: any): any;
runs(func: SpecFunction): Spec;
addToQueue(block: Block): void;
addMatcherResult(result: Result): void;
expect(actual: any): any;
waits(timeout: number): Spec;
waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec;
fail(e?: any): void;
getMatchersClass_(): Matchers;
addMatchers(matchersPrototype: CustomMatcherFactories): void;
finishCallback(): void;
finish(onComplete?: () => void): void;
after(doAfter: SpecFunction): void;
execute(onComplete?: () => void): any;
addBeforesAndAftersToQueue(): void;
explodes(): void;
spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy;
removeAllSpies(): void;
}
interface XSpec {
id: number;
runs(): void;
}
interface Suite extends SuiteOrSpec {
new (env: Env, description: string, specDefinitions: () => void, parentSuite: Suite): any;
parentSuite: Suite;
getFullName(): string;
finish(onComplete?: () => void): void;
beforeEach(beforeEachFunction: SpecFunction): void;
afterEach(afterEachFunction: SpecFunction): void;
beforeAll(beforeAllFunction: SpecFunction): void;
afterAll(afterAllFunction: SpecFunction): void;
results(): NestedResults;
add(suiteOrSpec: SuiteOrSpec): void;
specs(): Spec[];
suites(): Suite[];
children(): any[];
execute(onComplete?: () => void): void;
}
interface XSuite {
execute(): void;
}
interface Spy {
(...params: any[]): any;
identity: string;
and: SpyAnd;
calls: Calls;
mostRecentCall: { args: any[]; };
argsForCall: any[];
wasCalled: boolean;
}
interface SpyAnd {
/** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */
callThrough(): Spy;
/** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */
returnValue(val: any): Spy;
/** By chaining the spy with and.returnValues, all calls to the function will return specific values in order until it reaches the end of the return values list. */
returnValues(...values: any[]): Spy;
/** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */
callFake(fn: Function): Spy;
/** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */
throwError(msg: string): Spy;
/** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */
stub(): Spy;
}
interface Calls {
/** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. **/
any(): boolean;
/** By chaining the spy with calls.count(), will return the number of times the spy was called **/
count(): number;
/** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index **/
argsFor(index: number): any[];
/** By chaining the spy with calls.allArgs(), will return the arguments to all calls **/
allArgs(): any[];
/** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls **/
all(): CallInfo[];
/** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call **/
mostRecent(): CallInfo;
/** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call **/
first(): CallInfo;
/** By chaining the spy with calls.reset(), will clears all tracking for a spy **/
reset(): void;
}
interface CallInfo {
/** The context (the this) for the call */
object: any;
/** All arguments passed to the call */
args: any[];
/** The return value of the call */
returnValue: any;
}
interface Util {
inherit(childClass: Function, parentClass: Function): any;
formatException(e: any): any;
htmlEscape(str: string): string;
argsToArray(args: any): any;
extend(destination: any, source: any): any;
}
interface JsApiReporter extends Reporter {
started: boolean;
finished: boolean;
result: any;
messages: any;
new (): any;
suites(): Suite[];
summarize_(suiteOrSpec: SuiteOrSpec): any;
results(): any;
resultsForSpec(specId: any): any;
log(str: any): any;
resultsForSpecs(specIds: any): any;
summarizeResult_(result: any): any;
}
interface Jasmine {
Spec: Spec;
clock: Clock;
util: Util;
}
export var HtmlReporter: HtmlReporter;
export var HtmlSpecFilter: HtmlSpecFilter;
export var DEFAULT_TIMEOUT_INTERVAL: number;
}

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/36a1be34dbe202c665b3ddafd50824f78c09eea3/jasmine/jasmine.d.ts",
"raw": "registry:dt/jasmine#2.2.0+20160505161446",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/36a1be34dbe202c665b3ddafd50824f78c09eea3/jasmine/jasmine.d.ts"
}
}

View File

@ -1,80 +0,0 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/json-pointer/json-pointer.d.ts
declare module "json-pointer" {
function JSON_Pointer(object: Object): JSON_Pointer.JSON_PointerWrap;
namespace JSON_Pointer {
/**
* Wrap an object with accessors
*/
/**
* Looks up a JSON pointer in an object.
*/
function get(object: Object, pointer: string): any;
/**
* Set a value for a JSON pointer on object.
*/
function set(object: Object, pointer: string, value: any): void;
/**
* Removes an attribute of object referenced by pointer
*/
function remove(object: Object, pointer: string): void;
/**
* Creates a dictionary object (pointer -> value).
*/
function dict(object: Object): Object;
/**
* Just like: each(pointer.dict(obj), iterator);
*/
function walk(object: Object, iterator: (value: any, key: string) => void): void;
/**
* Tests if an object has a value for a JSON pointer.
*/
function has(object: Object, pointer: string): boolean;
/**
* Escapes a reference token.
*/
function escape(str: string): string;
/**
* Unescape a reference token.
*/
function unescape(str: string): string;
/**
* Converts a JSON pointer into an array of reference tokens.
*/
function parse(str: string): string[];
/**
* Builds a json pointer from an array of reference tokens.
*/
function compile(str: string[]): string;
interface JSON_PointerWrap {
/**
* Looks up a JSON pointer in an object.
*/
get(pointer: string): any;
/**
* Set a value for a JSON pointer on object.
*/
set(pointer: string, value: any): void;
/**
* Removes an attribute of object referenced by pointer
*/
remove(pointer: string): void;
/**
* Creates a dictionary object (pointer -> value).
*/
dict(): Object;
/**
* Just like: each(pointer.dict(obj), iterator);
*/
walk(iterator: (value: any, key: string) => void): void;
/**
* Tests if an object has a value for a JSON pointer.
*/
has(pointer: string): boolean;
}
}
export default JSON_Pointer;
}

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/json-pointer/json-pointer.d.ts",
"raw": "registry:dt/json-pointer#1.0.0+20160317120654",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/json-pointer/json-pointer.d.ts"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/91d45c49a3b5cd6a0abbf5f319c1406fd4f2b1e7/node/node.d.ts",
"raw": "registry:dt/node#6.0.0+20160720070758",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/91d45c49a3b5cd6a0abbf5f319c1406fd4f2b1e7/node/node.d.ts"
}
}

View File

@ -1,168 +0,0 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/445ed7e54c1b2a8e84610afab0aab2b2ee2ffb4e/should/should.d.ts
interface Object {
should: ShouldAssertion;
}
interface ShouldAssertion {
// basic grammar
a: ShouldAssertion;
an: ShouldAssertion;
and: ShouldAssertion;
be: ShouldAssertion;
has: ShouldAssertion;
have: ShouldAssertion;
is: ShouldAssertion;
it: ShouldAssertion;
with: ShouldAssertion;
which: ShouldAssertion;
the: ShouldAssertion;
of: ShouldAssertion;
not: ShouldAssertion;
// validators
arguments(): ShouldAssertion;
empty(): ShouldAssertion;
ok(): ShouldAssertion;
true(): ShouldAssertion;
false(): ShouldAssertion;
NaN(): ShouldAssertion;
Infinity(): ShouldAssertion;
Array(): ShouldAssertion;
Object(): ShouldAssertion;
String(): ShouldAssertion;
Boolean(): ShouldAssertion;
Number(): ShouldAssertion;
Error(): ShouldAssertion;
Function(): ShouldAssertion;
Date(): ShouldAssertion;
Class(): ShouldAssertion;
Undefined(): ShouldAssertion;
generator(): ShouldAssertion;
iterable(): ShouldAssertion;
iterator(): ShouldAssertion;
eql(expected: any, description?: string): ShouldAssertion;
equal(expected: any, description?: string): ShouldAssertion;
equalOneOf(...values: any[]): ShouldAssertion;
within(start: number, finish: number, description?: string): ShouldAssertion;
approximately(value: number, delta: number, description?: string): ShouldAssertion;
type(expected: any, description?: string): ShouldAssertion;
instanceof(constructor: Function, description?: string): ShouldAssertion;
above(n: number, description?: string): ShouldAssertion;
below(n: number, description?: string): ShouldAssertion;
aboveOrEqual(n: number, description?: string): ShouldAssertion;
greaterThanOrEqual(n: number, description?: string): ShouldAssertion;
belowOrEqual(n: number, description?: string): ShouldAssertion;
lessThanOrEqual(n: number, description?: string): ShouldAssertion;
match(other: {}, description?: string): ShouldAssertion;
match(other: (val: any) => any, description?: string): ShouldAssertion;
match(regexp: RegExp, description?: string): ShouldAssertion;
match(other: any, description?: string): ShouldAssertion;
matchEach(other: {}, description?: string): ShouldAssertion;
matchEach(other: (val: any) => any, description?: string): ShouldAssertion;
matchEach(regexp: RegExp, description?: string): ShouldAssertion;
matchEach(other: any, description?: string): ShouldAssertion;
matchAny(other: {}, description?: string): ShouldAssertion;
matchAny(other: (val: any) => any, description?: string): ShouldAssertion;
matchAny(regexp: RegExp, description?: string): ShouldAssertion;
matchAny(other: any, description?: string): ShouldAssertion;
length(n: number, description?: string): ShouldAssertion;
property(name: string, description?: string): ShouldAssertion;
property(name: string, val: any, description?: string): ShouldAssertion;
properties(names: string[]): ShouldAssertion;
properties(name: string): ShouldAssertion;
properties(descriptor: any): ShouldAssertion;
properties(...properties: string[]): ShouldAssertion;
propertyByPath(...properties: string[]): ShouldAssertion;
propertyWithDescriptor(name: string, descriptor: PropertyDescriptor): ShouldAssertion;
oneOf(...values: any[]): ShouldAssertion;
ownProperty(name: string, description?: string): ShouldAssertion;
containEql(obj: any): ShouldAssertion;
containDeep(obj: any): ShouldAssertion;
containDeepOrdered(obj: any): ShouldAssertion;
keys(...allKeys: string[]): ShouldAssertion;
keys(allKeys: string[]): ShouldAssertion;
enumerable(property: string, value?: any): ShouldAssertion;
enumerables(...properties: string[]): ShouldAssertion;
startWith(expected: string, message?: any): ShouldAssertion;
endWith(expected: string, message?: any): ShouldAssertion;
throw(message?: any): ShouldAssertion;
//http
header(field: string, val?: string): ShouldAssertion;
status(code: number): ShouldAssertion;
json(): ShouldAssertion;
html(): ShouldAssertion;
//stubs
alwaysCalledOn(thisTarget: any): ShouldAssertion;
alwaysCalledWith(...arguments: any[]): ShouldAssertion;
alwaysCalledWithExactly(...arguments: any[]): ShouldAssertion;
alwaysCalledWithMatch(...arguments: any[]): ShouldAssertion;
alwaysCalledWithNew(): ShouldAssertion;
alwaysThrew(exception?: any): ShouldAssertion;
callCount(count: number): ShouldAssertion;
called(): ShouldAssertion;
calledOn(thisTarget: any): ShouldAssertion;
calledOnce(): ShouldAssertion;
calledTwice(): ShouldAssertion;
calledThrice(): ShouldAssertion;
calledWith(...arguments: any[]): ShouldAssertion;
calledWithExactly(...arguments: any[]): ShouldAssertion;
calledWithMatch(...arguments: any[]): ShouldAssertion;
calledWithNew(): ShouldAssertion;
neverCalledWith(...arguments: any[]): ShouldAssertion;
neverCalledWithMatch(...arguments: any[]): ShouldAssertion;
threw(exception?: any): ShouldAssertion;
// aliases
True(): ShouldAssertion;
False(): ShouldAssertion;
Arguments(): ShouldAssertion;
class(): ShouldAssertion;
deepEqual(expected: any, description?: string): ShouldAssertion;
exactly(expected: any, description?: string): ShouldAssertion;
instanceOf(constructor: Function, description?: string): ShouldAssertion;
throwError(message?: any): ShouldAssertion;
lengthOf(n: number, description?: string): ShouldAssertion;
key(key: string): ShouldAssertion;
hasOwnProperty(name: string, description?: string): ShouldAssertion;
greaterThan(n: number, description?: string): ShouldAssertion;
lessThan(n: number, description?: string): ShouldAssertion;
}
interface ShouldInternal {
// should.js's extras
exist(actual: any, msg?: string): void;
exists(actual: any, msg?: string): void;
not: ShouldInternal;
}
interface Internal extends ShouldInternal {
(obj: any): ShouldAssertion;
// node.js's assert functions
fail(actual: any, expected: any, message: string, operator: string): void;
assert(value: any, message: string): void;
ok(value: any, message?: string): void;
equal(actual: any, expected: any, message?: string): void;
notEqual(actual: any, expected: any, message?: string): void;
deepEqual(actual: any, expected: any, message?: string): void;
notDeepEqual(actual: any, expected: any, message?: string): void;
strictEqual(actual: any, expected: any, message?: string): void;
notStrictEqual(actual: any, expected: any, message?: string): void;
throws(block: any, error?: any, message?: string): void;
doesNotThrow(block: any, message?: string): void;
ifError(value: any): void;
inspect(value: any, obj: any): any;
}
declare var should: Internal;
declare var Should: Internal;
interface Window {
Should: Internal;
}
declare module "should" {
export = should;
}

Some files were not shown because too many files have changed in this diff Show More