-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
Fixes #135 * Convert all .js to .ts - and update build * Bump version number * Update Node version for builds on CircleCI * Update test coverage & test coverage reporting
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
**/coverage | ||
**/node_modules | ||
**/npm-debug.log | ||
**/test-coverage | ||
**/yarn-error.log |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const path = require('path') | ||
|
||
module.exports = { | ||
collectCoverageFrom: [ | ||
'**/source/**/*.{ts,tsx,js}', | ||
'!**/node_modules/**', | ||
'!**/lib/**', | ||
], | ||
coverageDirectory: path.resolve(__dirname, 'test-coverage'), | ||
coverageReporters: ['html', 'lcov'], | ||
coverageThreshold: { | ||
global: { branches: 85, functions: 95, lines: 95, statements: 95 }, | ||
}, | ||
globals: { | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], | ||
}, | ||
moduleDirectories: ['node_modules'], | ||
/* eslint-disable sort-keys */ | ||
moduleNameMapper: { | ||
'^(.*).scss$': path.resolve(__dirname, 'jest/mock.styles.ts'), | ||
'^(.*).(jpg|png|gif|eot|otf|svg|ttf|woff2?)$': path.resolve(__dirname, 'jest/mock.files.ts'), | ||
}, | ||
/* eslint-enable sort-keys */ | ||
modulePaths: [ | ||
'<rootDir>/mocks', | ||
'<rootDir>/node_modules', | ||
], | ||
setupFilesAfterEnv: [ | ||
path.resolve(__dirname, 'jest/jest.setup.ts'), | ||
], | ||
testEnvironment: 'jest-environment-jsdom-fourteen', | ||
transform: { | ||
'^.+\\.[jt]sx?$': 'babel-jest', | ||
}, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default {} // eslint-disable-line |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 'fake-file' // eslint-disable-line |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React, { Component } from 'react'; | ||
import type { Expression, JSXElement, JSXIdentifier, JSXMemberExpression, MemberExpression } from '../types/acorn-jsx'; | ||
declare type BlacklistedAttr = string | RegExp; | ||
declare type Props = { | ||
allowUnknownElements?: boolean; | ||
bindings?: { | ||
[key: string]: any; | ||
}; | ||
blacklistedAttrs?: BlacklistedAttr[]; | ||
blacklistedTags?: string[]; | ||
className?: string; | ||
components?: React.JSXElementConstructor<any>[]; | ||
componentsOnly?: boolean; | ||
disableFragments?: boolean; | ||
disableKeyGeneration?: boolean; | ||
jsx?: string; | ||
onError?: (error: Error) => void; | ||
showWarnings?: boolean; | ||
renderError?: ({ error: string }: { | ||
error: any; | ||
}) => JSX.Element; | ||
renderInWrapper?: boolean; | ||
renderUnrecognized?: (tagName: string) => JSX.Element; | ||
}; | ||
export declare type ParsedJSX = JSX.Element | boolean | string; | ||
export declare type ParsedTree = ParsedJSX | ParsedJSX[]; | ||
export default class JsxParser extends Component<Props> { | ||
static displayName: string; | ||
static defaultProps: { | ||
allowUnknownElements: boolean; | ||
bindings: {}; | ||
blacklistedAttrs: RegExp[]; | ||
blacklistedTags: string[]; | ||
className: string; | ||
components: any[]; | ||
componentsOnly: boolean; | ||
disableFragments: boolean; | ||
disableKeyGeneration: boolean; | ||
jsx: string; | ||
onError: () => void; | ||
showWarnings: boolean; | ||
renderError: any; | ||
renderInWrapper: boolean; | ||
renderUnrecognized: () => any; | ||
}; | ||
ParsedChildren: ParsedTree; | ||
parseJSX: (jsx: string) => JSX.Element | JSX.Element[]; | ||
parseExpression: (expression: Expression) => any; | ||
parseMemberExpression: (expression: MemberExpression) => any; | ||
parseName: (element: JSXIdentifier | JSXMemberExpression) => string; | ||
parseElement: (element: JSXElement) => JSX.Element | JSX.Element[]; | ||
render: () => JSX.Element; | ||
} | ||
export {}; | ||
//# sourceMappingURL=JsxParser.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
declare const _default: { | ||
class: string; | ||
for: string; | ||
maxlength: string; | ||
colspan: string; | ||
rowspan: string; | ||
}; | ||
export default _default; | ||
//# sourceMappingURL=attributeNames.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
declare const VOID_ELEMENTS: string[]; | ||
export default VOID_ELEMENTS; | ||
export declare function canHaveChildren(tagName: string): boolean; | ||
export declare function canHaveWhitespace(tagName: string): boolean; | ||
//# sourceMappingURL=specialTags.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Converts a string from other cases to camelCase | ||
* @param string the value to camelCase | ||
* @example | ||
* camelCase('foo-bar') // 'fooBar' | ||
*/ | ||
export declare const camelCase: (string: string) => string; | ||
//# sourceMappingURL=camelCase.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Hashes a value | ||
* @param value the value to hash | ||
* @param radix the base-n to hash into (default 16) | ||
*/ | ||
export declare const hash: (value?: string, radix?: number) => string; | ||
/** | ||
* Hashes a Math.random() value, returning it in base16 | ||
*/ | ||
export declare const randomHash: () => string; | ||
//# sourceMappingURL=hash.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
declare type Style = string | Partial<CSSStyleDeclaration>; | ||
/** | ||
* Converts a CSS Style string | ||
* @param {string | Partial<CSSStyleDeclaration>} style A string to convert, or object to return | ||
* @returns {Partial<CSSStyleDeclaration>} a partial CSSStyleDeclaration | ||
*/ | ||
export declare const parseStyle: (style: Style) => Partial<CSSStyleDeclaration>; | ||
export {}; | ||
//# sourceMappingURL=parseStyle.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Returns the result of a path query from an object | ||
* @param {any} object the object to search | ||
* @param {string} path the path, whose value will be retrieved | ||
* @returns {any} the value (undefined if the path doesn't exist) | ||
* @example | ||
* resolvePath({ foo: { bar: { baz: 3 } } }, 'foo.bar.baz') // 3 | ||
*/ | ||
export declare const resolvePath: (object: any, path: string) => any; | ||
//# sourceMappingURL=resolvePath.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './components/JsxParser'; | ||
//# sourceMappingURL=index.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
export declare type BaseExpression = { | ||
type: string; | ||
start: number; | ||
}; | ||
export declare type JSXAttribute = BaseExpression & { | ||
type: 'JSXAttribute'; | ||
elements?: Expression[]; | ||
expression?: null | Expression; | ||
name: { | ||
name: string; | ||
}; | ||
value: Expression; | ||
}; | ||
export declare type JSXAttributeExpression = BaseExpression & { | ||
type: 'JSXAttributeExpression'; | ||
argument?: Expression; | ||
}; | ||
export declare type JSXElement = BaseExpression & { | ||
type: 'JSXElement'; | ||
children: JSXElement[]; | ||
openingElement: JSXElement & { | ||
attributes: JSXAttribute[]; | ||
}; | ||
name: JSXIdentifier | JSXMemberExpression; | ||
}; | ||
export declare type JSXExpressionContainer = BaseExpression & { | ||
type: 'JSXExpressionContainer'; | ||
expression: Expression; | ||
}; | ||
export declare type JSXIdentifier = BaseExpression & { | ||
type: 'JSXIdentifier'; | ||
name: string; | ||
}; | ||
export declare type JSXMemberExpression = BaseExpression & { | ||
type: 'JSXMemberExpression'; | ||
object: JSXIdentifier | JSXMemberExpression; | ||
property: JSXIdentifier | JSXMemberExpression; | ||
}; | ||
export declare type JSXSpreadAttribute = BaseExpression & { | ||
type: 'JSXSpreadAttribute'; | ||
argument: Identifier; | ||
}; | ||
export declare type JSXText = BaseExpression & { | ||
type: 'JSXText'; | ||
value: string; | ||
}; | ||
export declare type ArrayExpression = BaseExpression & { | ||
type: 'ArrayExpression'; | ||
elements: Expression[]; | ||
}; | ||
export declare type BinaryExpression = BaseExpression & { | ||
type: 'BinaryExpression'; | ||
left: Expression; | ||
operator: string; | ||
right: Expression; | ||
}; | ||
export declare type CallExpression = BaseExpression & { | ||
type: 'CallExpression'; | ||
arguments: Expression[]; | ||
callee?: Expression; | ||
}; | ||
export declare type ConditionalExpression = BaseExpression & { | ||
type: 'ConditionalExpression'; | ||
alternate: Expression; | ||
consequent: Expression; | ||
test: Expression; | ||
}; | ||
export declare type ExpressionStatement = BaseExpression & { | ||
type: 'ExpressionStatement'; | ||
expression: Expression; | ||
}; | ||
export declare type Identifier = BaseExpression & { | ||
type: 'Identifier'; | ||
name: string; | ||
}; | ||
export declare type Literal = BaseExpression & { | ||
type: 'Literal'; | ||
value: string; | ||
}; | ||
export declare type LogicalExpression = BaseExpression & { | ||
type: 'LogicalExpression'; | ||
left: Expression; | ||
operator: string; | ||
right: Expression; | ||
}; | ||
export declare type MemberExpression = BaseExpression & { | ||
type: 'MemberExpression'; | ||
computed: boolean; | ||
name?: string; | ||
object: Literal | MemberExpression; | ||
property?: MemberExpression; | ||
raw?: string; | ||
}; | ||
export declare type ObjectExpression = BaseExpression & { | ||
type: 'ObjectExpression'; | ||
properties: [{ | ||
key: { | ||
name?: string; | ||
value?: string; | ||
}; | ||
value: Expression; | ||
}]; | ||
}; | ||
export declare type TemplateElement = BaseExpression & { | ||
type: 'TemplateElement'; | ||
value: { | ||
cooked: string; | ||
}; | ||
}; | ||
export declare type TemplateLiteral = BaseExpression & { | ||
type: 'TemplateLiteral'; | ||
expressions: Expression[]; | ||
quasis: Expression[]; | ||
}; | ||
export declare type UnaryExpression = BaseExpression & { | ||
type: 'UnaryExpression'; | ||
operator: string; | ||
argument: { | ||
value: any; | ||
}; | ||
}; | ||
export declare type Expression = JSXAttribute | JSXAttributeExpression | JSXElement | JSXExpressionContainer | JSXSpreadAttribute | JSXText | ArrayExpression | BinaryExpression | CallExpression | ConditionalExpression | ExpressionStatement | Identifier | Literal | LogicalExpression | MemberExpression | ObjectExpression | TemplateElement | TemplateLiteral | UnaryExpression; | ||
//# sourceMappingURL=acorn-jsx.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Large diffs are not rendered by default.