Skip to content

Commit

Permalink
convert to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Apr 22, 2019
1 parent df0fe5c commit d2a095a
Show file tree
Hide file tree
Showing 14 changed files with 304 additions and 147 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules/
lib/
dist/
coverage/
types/
.vscode/
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ src/
rollup.config.js
test/
coverage/
types/tsconfig.tsbuildinfo
.travis.yml
*.config.js
86 changes: 81 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dom-expressions",
"description": "A Fine-Grained Runtime for Performant DOM Rendering",
"version": "0.7.1",
"version": "0.7.2",
"author": "Ryan Carniato",
"license": "MIT",
"repository": {
Expand All @@ -11,19 +11,23 @@
"readmeFilename": "README.md",
"module": "dist/dom-expressions.js",
"main": "lib/dom-expressions.js",
"types": "types/index.d.ts",
"sideEffects": false,
"scripts": {
"build": "rollup -c",
"build": "rollup -c && tsc",
"test": "npm run build && jest --coverage",
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@babel/core": "7.4.3",
"@babel/preset-typescript": "7.3.3",
"babel-plugin-jsx-dom-expressions": "*",
"coveralls": "3.0.3",
"jest": "^24.7.0",
"rollup": "^1.8.0",
"rollup-plugin-node-resolve": "^4.0.1",
"s-js": "0.4.9"
"jest": "24.7.1",
"rollup": "1.10.1",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-node-resolve": "4.2.3",
"s-js": "0.4.9",
"typescript": "3.4.4"
}
}
15 changes: 13 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
import babel from 'rollup-plugin-babel';
import nodeResolve from 'rollup-plugin-node-resolve';

const plugins = [nodeResolve()]
const plugins = [
nodeResolve({
extensions: ['.js', '.ts']
}),
babel({
extensions: ['.js', '.ts'],
presets: ["@babel/preset-typescript"],
exclude: 'node_modules/**',
retainLines: true
})
]

export default {
input: 'src/index.js',
input: 'src/index.ts',
output: [{
file: 'lib/dom-expressions.js',
format: 'cjs',
Expand Down
42 changes: 0 additions & 42 deletions src/Attributes.js

This file was deleted.

51 changes: 51 additions & 0 deletions src/Attributes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
type AttributeInfo = {
[key: string]: {
type: string,
alias?: string
}
}

const Types = {
ATTRIBUTE: 'attribute',
PROPERTY: 'property'
},
Attributes: AttributeInfo = {
href: {
type: Types.ATTRIBUTE
},
style: {
type: Types.PROPERTY,
alias: 'style.cssText'
},
for: {
type: Types.PROPERTY,
alias: 'htmlFor'
},
class: {
type: Types.PROPERTY,
alias: 'className'
},
// React compat
spellCheck: {
type: Types.PROPERTY,
alias: 'spellcheck'
},
allowFullScreen: {
type: Types.PROPERTY,
alias: 'allowFullscreen'
},
autoCapitalize: {
type: Types.PROPERTY,
alias: 'autocapitalize'
},
autoFocus: {
type: Types.PROPERTY,
alias: 'autofocus'
},
autoPlay: {
type: Types.PROPERTY,
alias: 'autoplay'
}
};

export default Attributes;
File renamed without changes.
Loading

0 comments on commit d2a095a

Please sign in to comment.