diff --git a/package-lock.json b/package-lock.json index 06c8dd9..65f4463 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "next-contentful", - "version": "0.2.1", + "version": "0.3.0-beta.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2265,6 +2265,26 @@ "integrity": "sha512-wp6IOGu1lxsfnrD+5mX6qwSwWuqsdkKKxTN4aQc4wByHAKZJf9/D4KXPQ1POUjEbnCP5LMggB0OEFNY9OTsMqg==", "dev": true }, + "@types/parsimmon": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@types/parsimmon/-/parsimmon-1.10.0.tgz", + "integrity": "sha512-bsTIJFVQv7jnvNiC42ld2pQW2KRI+pAG243L+iATvqzy3X6+NH1obz2itRKDZZ8VVhN3wjwYax/VBGCcXzgTqQ==", + "dev": true + }, + "@types/prop-types": { + "version": "15.7.1", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.1.tgz", + "integrity": "sha512-CFzn9idOEpHrgdw8JsoTkaDDyRWk1jrzIV8djzcgpq0y9tG4B4lFT+Nxh52DVpDXV+n4+NPNv7M1Dj5uMp6XFg==" + }, + "@types/react": { + "version": "16.8.14", + "resolved": "https://registry.npmjs.org/@types/react/-/react-16.8.14.tgz", + "integrity": "sha512-26tFVJ1omGmzIdFTFmnC5zhz1GTaqCjxgUxV4KzWvsybF42P7/j4RBn6UeO3KbHPXqKWZszMXMoI65xIWm954A==", + "requires": { + "@types/prop-types": "*", + "csstype": "^2.2.0" + } + }, "@types/resolve": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", @@ -2964,6 +2984,50 @@ } } }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, "babel-core": { "version": "7.0.0-bridge.0", "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-7.0.0-bridge.0.tgz", @@ -3872,9 +3936,9 @@ } }, "contentful-parsers": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/contentful-parsers/-/contentful-parsers-0.2.1.tgz", - "integrity": "sha512-9biWlNpqHgSyRiGFxUYx/tKFJu9M2WIgUzLJpFbFHVLq9F10L3vngFD5CP+pixeE6lqdkpp/CS7I/atevfLR+w==", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/contentful-parsers/-/contentful-parsers-0.2.2.tgz", + "integrity": "sha512-aSCPUiqjm/81axfTItvx8Ph+1v2vVABGJACHC/pCzabRCyk/m0Sdu2udGGGa6Ep9tyLTAGU9HGY/8XKmfFe6Yg==", "requires": { "@babel/runtime": "^7.4.3" } @@ -4093,6 +4157,11 @@ "cssom": "0.3.x" } }, + "csstype": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.4.tgz", + "integrity": "sha512-lAJUJP3M6HxFXbqtGRc0iZrdyeN+WzOWeY0q/VnFzI+kqVrYIzC7bWlKqCW7oCIdzoPkvfp82EVvrTlQ8zsWQg==" + }, "cyclist": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", @@ -4245,6 +4314,16 @@ } } }, + "definitelytyped-header-parser": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/definitelytyped-header-parser/-/definitelytyped-header-parser-1.1.0.tgz", + "integrity": "sha512-goGRhRUJVQhXc28OjwSCoAoutl/dcFUJXwEv3DYdtxGFCXWK+YFS/MrFfsAnHG0ZYPKBcniXWRUlr3UHGKaTHw==", + "dev": true, + "requires": { + "@types/parsimmon": "^1.3.0", + "parsimmon": "^1.2.0" + } + }, "del": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", @@ -4301,6 +4380,12 @@ "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=", "dev": true }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, "diff-sequences": { "version": "24.3.0", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.3.0.tgz", @@ -4374,6 +4459,38 @@ "domelementtype": "1" } }, + "download-file-sync": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/download-file-sync/-/download-file-sync-1.0.4.tgz", + "integrity": "sha1-0+PFQ/g29BA5RVuQNMcuNVsDYBk=", + "dev": true + }, + "dts-critic": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/dts-critic/-/dts-critic-1.0.6.tgz", + "integrity": "sha512-4ELGB//kunDK88U1aYurzdnNlm9hbUI6VHlgQe39TzvzfeUSxQ634Rbm4qJvtGIW6hmqDnxw4D4+QAMQMd7nQw==", + "dev": true, + "requires": { + "definitelytyped-header-parser": "^1.0.1", + "download-file-sync": "^1.0.4", + "yargs": "^12.0.5" + } + }, + "dtslint": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/dtslint/-/dtslint-0.6.2.tgz", + "integrity": "sha512-JClRWsqxFNtSKz4dLcDhVfoTHNSAavgDbzvRKspPfi+FDtYnzrFFxC4gLIsqP77faVLSwCkEUPoK7PThh9B4Tg==", + "dev": true, + "requires": { + "definitelytyped-header-parser": "^1.0.1", + "dts-critic": "^1.0.6", + "fs-extra": "^6.0.1", + "request": "^2.88.0", + "strip-json-comments": "^2.0.1", + "tslint": "5.14.0", + "typescript": "^3.5.0-dev.20190419" + } + }, "duplexer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", @@ -5190,6 +5307,17 @@ "readable-stream": "^2.0.0" } }, + "fs-extra": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", + "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, "fs-readdir-recursive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", @@ -6063,6 +6191,15 @@ "function-bind": "^1.1.1" } }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -8283,6 +8420,15 @@ } } }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, "jsonify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", @@ -9666,6 +9812,12 @@ "@types/node": "*" } }, + "parsimmon": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.12.0.tgz", + "integrity": "sha512-uC/BjuSfb4jfaWajKCp1mVncXXq+V1twbcYChbTxN3GM7fn+8XoHwUdvUz+PTaFtDSCRQxU8+Rnh+iMhAkVwdw==", + "dev": true + }, "pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", @@ -10095,12 +10247,13 @@ } }, "react-contentful": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/react-contentful/-/react-contentful-1.2.2.tgz", - "integrity": "sha512-9edjWiv3rM+4ixtxJ3hItAeQBR0mKacmvjncYMtX+tW1w802nDmtfnyuUSNauYJ/dJoY9nSqC35ZvRJ0RnXxGA==", + "version": "1.3.0-beta.5", + "resolved": "https://registry.npmjs.org/react-contentful/-/react-contentful-1.3.0-beta.5.tgz", + "integrity": "sha512-MqQwOq+jXC8IGzWZ4JK1sNQO00qbZQ7EGnx+Qm93mH3/HlSnk/H2y6sGe6sUTP5aeeUTEnVIvA/8IuAytGUIhg==", "requires": { "@babel/runtime": "^7.4.3", "@contentful/rich-text-react-renderer": "^13.2.0", + "@types/react": "^16.8.13", "contentful": "^7.5.0", "contentful-parsers": "^0.2.1", "flatted": "^2.0.0", @@ -10555,20 +10708,20 @@ } }, "rollup": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.10.0.tgz", - "integrity": "sha512-U9t/JaKtO0+X0pSmLVKMrAZEixrbVzITf193TiEhfoVKCnd7pDimIFo94IxUCgbn6+v5VmduHkubx2VV1s0Ftw==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.10.1.tgz", + "integrity": "sha512-pW353tmBE7QP622ITkGxtqF0d5gSRCVPD9xqM+fcPjudeZfoXMFW2sCzsTe2TU/zU1xamIjiS9xuFCPVT9fESw==", "dev": true, "requires": { "@types/estree": "0.0.39", - "@types/node": "^11.13.4", + "@types/node": "^11.13.5", "acorn": "^6.1.1" }, "dependencies": { "@types/node": { - "version": "11.13.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.4.tgz", - "integrity": "sha512-+rabAZZ3Yn7tF/XPGHupKIL5EcAbrLxnTr/hgQICxbeuAfWtT0UZSfULE+ndusckBItcv4o6ZeOJplQikVcLvQ==", + "version": "11.13.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.6.tgz", + "integrity": "sha512-Xoo/EBzEe8HxTSwaZNLZjaW6M6tA/+GmD3/DZ6uo8qSaolE/9Oarko0oV1fVfrLqOz0tx0nXJB4rdD5c+vixLw==", "dev": true }, "acorn": { @@ -11515,6 +11668,12 @@ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, "styled-jsx": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-3.2.1.tgz", @@ -11810,6 +11969,44 @@ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", "dev": true }, + "tslint": { + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.14.0.tgz", + "integrity": "sha512-IUla/ieHVnB8Le7LdQFRGlVJid2T/gaJe5VkjzRVSRR6pA2ODYrnfR1hmxi+5+au9l50jBwpbBL34txgv4NnTQ==", + "dev": true, + "requires": { + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + }, + "dependencies": { + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + } + } + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "tty-aware-progress": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tty-aware-progress/-/tty-aware-progress-1.0.3.tgz", @@ -11855,6 +12052,12 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "typescript": { + "version": "3.5.0-dev.20190419", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.0-dev.20190419.tgz", + "integrity": "sha512-QtHgf03yDa18vJA/TKMoMLhcRjfLqoWvPEjlT5mJsURc/2r4TPWFrn2qWDBtE8swR0i9LvUfhaK7Y6SKSTWwJQ==", + "dev": true + }, "uglify-js": { "version": "3.4.9", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", @@ -11966,6 +12169,12 @@ "imurmurhash": "^0.1.4" } }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", diff --git a/package.json b/package.json index 14654a8..4406c48 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "next-contentful", - "version": "0.2.1", + "version": "0.3.0-beta.1", "description": "React library for integrating react-contentful into the server-side rendering of your Next.js app.", "repository": "ryanhefner/next-contentful", "keywords": [ @@ -25,6 +25,7 @@ "files": [ "es", "src", + "types", "hoc-utils.js", "index.js", "initContentful.js", @@ -36,6 +37,7 @@ "main": "index.js", "module": "es/index.js", "jsnext:main": "src/index.js", + "types": "types", "scripts": { "clean": "rm -f index.js && rm -rf es && rm -rf umd", "prebuild": "npm run clean", @@ -44,6 +46,7 @@ "prepare": "npm run build", "prepublishOnly": "node ./tools/build.js", "push-release": "git push origin master && git push --tags", + "dtslint": "dtslint types", "test": "jest --findRelatedTests src/index.js" }, "peerDependencies": { @@ -53,9 +56,10 @@ }, "dependencies": { "@babel/runtime": "^7.4.3", + "@types/react": "^16.8.14", "flatted": "^2.0.0", "prop-types": "^15.6.2", - "react-contentful": "^1.2.2" + "react-contentful": "^1.3.0-beta.5" }, "devDependencies": { "@babel/cli": "^7.4.3", @@ -71,6 +75,7 @@ "babel-plugin-transform-react-remove-prop-types": "^0.4.24", "babel-polyfill": "^6.26.0", "coveralls": "^3.0.2", + "dtslint": "^0.6.2", "enzyme": "^3.8.0", "enzyme-adapter-react-16": "^1.12.1", "greenkeeper-lockfile": "^1.15.1", @@ -84,7 +89,7 @@ "react-dom": "^16.8.6", "react-test-renderer": "^16.8.6", "regenerator-runtime": "^0.13.2", - "rollup": "^1.10.0", + "rollup": "^1.10.1", "rollup-plugin-babel": "^4.3.2", "rollup-plugin-commonjs": "^9.3.4", "rollup-plugin-json": "^4.0.0", diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..aba3df6 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,26 @@ +// TypeScript Version: 3.0 + +import { Component } from 'react'; +import { ContentfulClientInterface } from 'react-contentful'; + +/** + * initContentful + */ + +export interface initContentfulParams { + initialState: any; +} + +export function initContentful(params: initContentfulParams): ContentfulClientInterface; + +/** + * withContentful + */ + +export interface withContentfulParams { + accessToken: string; + host: string; + space: string; +} + +export function withContentful(params: withContentfulParams): Component; diff --git a/types/tsconfig.json b/types/tsconfig.json new file mode 100644 index 0000000..1ae2a6a --- /dev/null +++ b/types/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "noEmit": true + } +}