* Allow paper core import in TypeScript
Typings were missing when importing paper core version with:
`import * as paper from 'paper/dist/paper-core'` syntax.
This changes the generated TypeScript definition so that it exports two
modules: `paper` and `paper/dist/paper-core`. In the same logic,
`paper-core.d.ts` file is added to make sure that the corresponding
definition is automatically loaded.
This also takes care of the fact that `PaperScript` class is not
available in paper core version, by removing it from the corresponding
TypeScript definition.
Finally, this also simplifies existing definition by directly exporting
a `PaperScope` instance as the module instead of duplicating all
`PaperScope` properties and methods on the module itself.
Closes#1713
This add a gulp task (`gulp docs:typescript`) to automatically generate
a typescript definition for the library. This should solve the problem
of having an out of sync type definition when we change the API.
This task takes advantage of existing JSDoc parsing to generate a
temporary file which is later formatted through a mustache template to
generate the final definition. This definition is then tested by
compiling a typescript file that use it.
The generated definition is added to the `gulp zip` task in order to be
published along with the bundled library.
So 2 new dev-dependencies are added with this change: `mustache` and
`typescript` packages. Using node and mustache to generate the
definition instead of relying on existing templating system is
motivated by a better development experience, with easier debugging
possibilities... through the usage of more modern tools.
As a side note, support of "rest parameters" (when a parameter can be
present multiple times) is added to existing JSDoc parser in order to
support this pattern on typescript side (E.g. for `Color#set()` method
which accept any sequence of parameters that is supported by `Color`
constructors).