-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSPM support #2233
Comments
Yes please! |
+1 |
Aurelia makes extensive use of JSPM, and having worked with both I'd 👍 this. |
👍 |
Yes please! |
@mhegazy Accepting PRs? |
I actually like the JSPM work flow, and we should do that :) a couple of thoughts:
PRs are definitely welcomed |
I am sure you already know : https://github.com/teppeis/typescript-simple , it now does inline sourcemaps : teppeis/typescript-simple#7 (I used it for atom/atom#5898) |
We have to make sure this comes out requiring zero configuration beyond any steps needed to get typescript initially installed. |
@atrauzzi I was about to start work on this but noticed from : https://github.com/jspm/registry/blob/master/registry.json#L13 that there is Is there something more required? |
I have not evaluted the extension yet. I don't know what level of support there is. Can you debug the TS in the browser? |
I am the author of plugin-typescript and I'm currently converting a large multi-repository project over to using it. It does provide source-maps so you can debug TypeScript in the browser. I am very interested in any feedback people have, so if you find any issues or have suggestions for improvements you would like to see then please raise issues on that repository. I will be making some minor improvements to it over the coming week. |
I would still love to see a very simplified transpile method that has the option to embed the sourcemap content. |
Yes, and I think there has to be full clarity on how |
@frankwallis I could not view the source code when debugging my test project in Chrome. I just got the resulting JavaScript. I ran my test site in live-server. What am I doing wrong? Some features worth having when supporting SystemJS:
|
@atrauzzi - plugin-typescript resolves .d.ts files like SystemJS/commonJS, ie. 'common/angular.d.ts' will resolve differently to './common/angular.d.ts'. I have updated the readme to reflect this. I think this is really important. plugin-typescript is the 4th typescript plugin I have written and I am painfully aware of the issues with managing declaration files across multiple projects. I think that using commonJS resolution for them is a neat solution which avoids having to update versions in multiple places when things change. I think that tsc & tsify as nodeJs compilers ought to use nodeJs resolution, while plugin-typescript as the SystemJS compiler uses SystemJS resolution. It also doesn't lose you anything - if you don't want to opt in or it causes problems in your IDE then just use relative paths. @RobertSundstrom - please check you have the latest version of jspm installed (0.14 I think?), I have had no problems. If you still have trouble then raise an issue on that repo. @RobertSundstrom, @basarat - I really would love to see some IDE integration - I have this dream sometimes where I'm compiling apps in SystemJS and running them in a browser tab of Atom while stepping through my code inside the Atom editor! |
@frankwallis
Plugin version: plugin-typescript@^0.5.10 |
@RobertSundstrom - I have reproduced this now, will issue a fix shortly. |
@frankwallis 👍 for looking for a .d.ts in the package directory when referenced without How automatic is it? I'd like a way to write an npm package in .ts, such that my index.ts is compiled to index.js so that non-TS consumers are happy, but also TS users can just say:
And neither I nor they have to do anything else to make it work. At the moment if I understand it correctly, I (the package author) must extract type declarations from my code and wrap them in a separate
The And the consumer has to bring this Ideally it should be enough for the consumer to import the package, and the type information is found. I guess
But then index.ts might depend on interfaces declared in other files that are passed to |
@danielearwicker if you want to deliver typescript in systemjs and javascript in nodejs you can override "main" in the "jspm" section of package.json - set it to "./index.ts!" and everything will work. Currently you do need an external declaration file for the consumer - if you want these generated automatically then I would look at dts-bundle. This external declaration file should be delivered with its own package and then referenced form the consumer using /// references without the "./" Next week I am going to be seeing if I can get plugin-typescript to resolve ambient imports and if it finds another typescript file then it will trigger that compilation, autogenerate the correct .d.ts file (using dts-bundle) and inject that into the consumers compilation. This will mean it is doing a depth first compilation which is important. I think it is possible to do this, but I will find out more next week. |
Worth mentioning here : https://docs.google.com/document/d/139ImayzFfHwYDzPIfwOHgf4BsAsr4HIC0vaudF98Rog/mobilebasic |
For those using TypeScript with Aurelia and wanting to use JSPM, I've managed to get it working by piping the output from TypeScript (with Of course, if TS 1.5 adds support for You can checkout out my fork of Main issues:
|
I really hope that the TypeScript team are planning to support system.js. The JSPM and System.js workflow makes doing dev in a transpiled language feel first class. |
I have created frankwallis/plugin-typescript#16, and I'm planning to implement this over the next week or two. |
Amazing. Thanks !!! |
I have been watching this one: systemjs/systemjs#432 As soon as these conflicts get resolved SystemJS will finally support TypeScript. |
TypeScript support is now in JSPM: jspm/jspm-cli#735 (comment) |
"not" or "now"? Where would people find docs on making use of this? |
Any updates on a JSPM sample? |
@johnjelinek JSPM 0.16 with TypeScript support is not officially released yet so our work over samples is still in progress. If you want to take a peek on intermediate results and ok with using the beta version of JSPM you can use https://github.com/Microsoft/TypeScriptSamples/tree/jspm/jspm |
Where can I track support for bundling in jspm? |
Testing https://github.com/Microsoft/TypeScriptSamples/tree/jspm/jspm with the latest jspm beta (0.16). I don't seem to get compile errors in the browser, e.g. this succeeds: function greeter(person: string) {
return "Hello, " + person;
}
var user = [0, 1, 2];
greeter(user); /cc @mhegazy |
@OliverJAsh complete typechecking in transpile scenarios is not possible: TypeScript compiler deliberately works within given file without attempting to resolve any references to external files (including standard library). In this circumstances it cannot build the full set of types that will be available in the program and will report lots of errors which are in fact false positives. If you want to have full-fledged editing experience with correct errors - you should use editor with TypeScript support i.e. VSCode, Sublime, Visual Studio, Atom etc. Support to compile isolated modules can be seen as merely a shortcut to avoid explicit compilation step but not the replacement for full program analysis which can be done i.e. in the editor or the compiling the whole program. |
@vladima Thanks for the explanation. I'm looking at VSCode and the IDE plugins now. Is it possible to hook these up to SystemJS so they read the config and can parse third party dependencies, e.g. |
@OliverJAsh That would be simply amazing. Would almost offer a first-class client side dev experience. I'm fairly curious about this, because I feel like there are numerous undiscovered challenges:
Probably more questions. But I feel like package development in JS is just insanely complex and difficult to reason about with or without TypeScript. |
I don't seem to get compile errors when bundling either (now supported in Tracking systemjs/builder#206 |
Technically bundling as it is done in jspm now is not a whole program analysis as it processes modules one by one. I already have a workitem in my list to add support for reporting syntax errors during Also we already have plenty of requests to add support for bunding in TypeScript compiler - is already in the roadmap (I think it is currently scheduled for 2.0). |
Currently JSPM understands typescript but the typescript compiler does not know how to resolve typings using jspm as it does with npm. This is significant for two reasons:
|
Is there meanwhile an example ? |
@SonofNun15 Is there an issue tracking this? |
@oising: yes, this one |
Why is this closed ? Where can we follow the progress on this ? |
It is closed because as mentioned above it is supported. There are the Microsoft/TypeScriptSamples which maybe a better place to focus your questions/look for answers. |
The JavaScript Package Manager, JSPM, is a frictionless package manager for JavaScript that is able to pull packages from various sources ("endpoints", as they are called), such as Node Package Manager (NPM) and Bower. Unifying all in one interface.
It also has the ability to load EcmaScript 6 modules through the System.js library that implements a loader.
One notable feature is its support for transpilers, traceur (with AtScript) and Babel (formerly e6to5), that brings the new ES6 syntax and features and makes it easy to get started with building modern JavaScript applications.
JSPM brings a dynamic developer experience that pulls dependencies on the the fly. When an app is ready to be deployed it can then be compiled and dependencies can be bundled.
The JSPM configuration-file is based on the NPM package.json format.
TypeScript should support this new ecosystem too.
The text was updated successfully, but these errors were encountered: