mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-31 18:14:07 +03:00
fix build
This commit is contained in:
parent
27aab501a9
commit
1e152f96f0
|
@ -12,18 +12,6 @@ const BANNER =
|
||||||
|
|
||||||
const IS_MODULE = process.env.IS_MODULE != null;
|
const IS_MODULE = process.env.IS_MODULE != null;
|
||||||
|
|
||||||
const TS_RULE = {
|
|
||||||
test: /\.ts$/,
|
|
||||||
loader: 'awesome-typescript-loader',
|
|
||||||
exclude: /(node_modules)/,
|
|
||||||
};
|
|
||||||
//
|
|
||||||
// if (IS_MODULE) {
|
|
||||||
// TS_RULE.query = {
|
|
||||||
// noEmitHelpers: false
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
context: root(),
|
context: root(),
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
|
@ -70,7 +58,14 @@ const config = {
|
||||||
exclude: [
|
exclude: [
|
||||||
/node_modules/
|
/node_modules/
|
||||||
]
|
]
|
||||||
}, TS_RULE, {
|
}, {
|
||||||
|
test: /node_modules\/.*\.ngfactory\.ts$/,
|
||||||
|
loader: 'awesome-typescript-loader'
|
||||||
|
}, {
|
||||||
|
test: /\.ts$/,
|
||||||
|
loader: 'awesome-typescript-loader',
|
||||||
|
exclude: /(node_modules)/,
|
||||||
|
}, {
|
||||||
test: /lib[\\\/].*\.css$/,
|
test: /lib[\\\/].*\.css$/,
|
||||||
loaders: ['raw-loader'],
|
loaders: ['raw-loader'],
|
||||||
exclude: [/redoc-initial-styles\.css$/]
|
exclude: [/redoc-initial-styles\.css$/]
|
||||||
|
|
|
@ -28,23 +28,12 @@ export class KeysPipe implements PipeTransform {
|
||||||
transform(value) {
|
transform(value) {
|
||||||
if (isBlank(value)) return value;
|
if (isBlank(value)) return value;
|
||||||
if (typeof value !== 'object') {
|
if (typeof value !== 'object') {
|
||||||
throw new InvalidPipeArgumentException(ValuesPipe, value);
|
throw new InvalidPipeArgumentException(KeysPipe, value);
|
||||||
}
|
}
|
||||||
return Object.keys(value);
|
return Object.keys(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Pipe({ name: 'values' })
|
|
||||||
export class ValuesPipe implements PipeTransform {
|
|
||||||
transform(value) {
|
|
||||||
if (isBlank(value)) return value;
|
|
||||||
if (typeof value !== 'object') {
|
|
||||||
throw new InvalidPipeArgumentException(ValuesPipe, value);
|
|
||||||
}
|
|
||||||
return Object.keys(value).map(key => value[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Pipe({ name: 'jsonPointerEscape' })
|
@Pipe({ name: 'jsonPointerEscape' })
|
||||||
export class JsonPointerEscapePipe implements PipeTransform {
|
export class JsonPointerEscapePipe implements PipeTransform {
|
||||||
transform(value:string) {
|
transform(value:string) {
|
||||||
|
|
|
@ -56,11 +56,11 @@
|
||||||
"@types/jasmine": "^2.2.32",
|
"@types/jasmine": "^2.2.32",
|
||||||
"@types/requirejs": "^2.1.26",
|
"@types/requirejs": "^2.1.26",
|
||||||
"@types/should": "^8.1.28",
|
"@types/should": "^8.1.28",
|
||||||
"angular2-template-loader": "^0.5.0",
|
"angular2-template-loader": "^0.6.0",
|
||||||
"awesome-typescript-loader": "^2.2.1",
|
"awesome-typescript-loader": "2.2.4",
|
||||||
"branch-release": "^1.0.3",
|
"branch-release": "^1.0.3",
|
||||||
"chalk": "^1.1.3",
|
"chalk": "^1.1.3",
|
||||||
"codelyzer": "^1.0.0-beta.2",
|
"codelyzer": "^1.0.0-beta.3",
|
||||||
"copy-webpack-plugin": "^3.0.1",
|
"copy-webpack-plugin": "^3.0.1",
|
||||||
"core-js": "^2.4.1",
|
"core-js": "^2.4.1",
|
||||||
"coveralls": "^2.11.9",
|
"coveralls": "^2.11.9",
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {KeysPipe, ValuesPipe, JsonPointerEscapePipe, MarkedPipe} from '../../lib/utils/pipes';
|
import {KeysPipe, JsonPointerEscapePipe, MarkedPipe} from '../../lib/utils/pipes';
|
||||||
|
|
||||||
describe('Pipes', () => {
|
describe('Pipes', () => {
|
||||||
describe('KeysPipe and ValuesPipe', () => {
|
describe('KeysPipe', () => {
|
||||||
let obj;
|
let obj;
|
||||||
var keysPipe, valuesPipe;
|
var keysPipe;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
obj = {
|
obj = {
|
||||||
|
@ -14,7 +14,6 @@ describe('Pipes', () => {
|
||||||
c: 3
|
c: 3
|
||||||
};
|
};
|
||||||
keysPipe = new KeysPipe();
|
keysPipe = new KeysPipe();
|
||||||
valuesPipe = new ValuesPipe();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('KeysPipe transform', () => {
|
describe('KeysPipe transform', () => {
|
||||||
|
@ -28,22 +27,6 @@ describe('Pipes', () => {
|
||||||
(() => keysPipe.transform('45')).should.throw();
|
(() => keysPipe.transform('45')).should.throw();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not throw on blank input', () => {
|
|
||||||
(() => valuesPipe.transform()).should.not.throw();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('KeysPipe transform', () => {
|
|
||||||
it('should return values', () => {
|
|
||||||
var val = valuesPipe.transform(obj);
|
|
||||||
val.should.be.deepEqual([1, 2, 3]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not support other objects', () => {
|
|
||||||
(() => valuesPipe.transform(45)).should.throw();
|
|
||||||
(() => valuesPipe.transform('45')).should.throw();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not throw on blank input', () => {
|
it('should not throw on blank input', () => {
|
||||||
(() => keysPipe.transform()).should.not.throw();
|
(() => keysPipe.transform()).should.not.throw();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user