Skip to content
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

Typescript to Javascript Packages #71

Closed
ToddThomson opened this issue Jan 16, 2016 · 4 comments
Closed

Typescript to Javascript Packages #71

ToddThomson opened this issue Jan 16, 2016 · 4 comments
Assignees

Comments

@ToddThomson
Copy link
Owner

The main idea/convention of TsProject ( however poorly documented ) is that Typescript code be organized around only classes that are in separate files. Essentially each class is an external module ( ES6 ). TsProject then takes a set of project files ( defined in a tsconfig.json project ) and creates any number of bundles from this set of project files based on the dependencies of the input files defining the bundle. The resultant bundle in then a single ES6 module/file.
For me, carving my code base into single ES6 modules and transpiling to ES5 module formats like AMD (Web) or commonjs (Node) makes sense until browsers and http2 catch up to all the needs that ES6 requires. I really have no interest in using tools like jspm or system-builder yet.
What I would like to have TsProject do in the short term is provide named packages that encapsulate components, libraries, etc where the package is minified ( all classes and methods become internal except for the package exports ) and a proper d.ts definition file is emitted.
This really isn't far from where TsProject is at the moment. However it does lock down some conventions that need to be made.
This feature will be in TsProject 1.2.

@ToddThomson
Copy link
Owner Author

TsProject should allow bundles ( a single file ES6 module library/component/application ) to restrict which exports are public ( and those which can be treated as internal ). This would allow a cleaner bundle definition file for the bundle and allow internal identifiers to be minimized.

@ToddThomson
Copy link
Owner Author

Add bundle configuration option "package":

export const enum BundlePackage {
    None = 0,
    Library = 1,
    Component = 2
}

None: no additional bundle processing.
Library: Injects a namespace as specified by the bundle configuration option "packageNamespace" around all exported types.
Component: Only those exports within a namespace specified by the bundle configuration option "packageNamespace" name are exported. All other exports are treated as internal.

@ToddThomson
Copy link
Owner Author

This feature is now in NPM release 1.2.0-rc.7

ToddThomson added a commit that referenced this issue Feb 5, 2016
Addresses issues #71, #66, #65
@ToddThomson
Copy link
Owner Author

Provided in TsProject 1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant