Now it mostly works with some limitations:
- ambient declarations seem not to be working, thus the following converters have temporarily been disabled: - punycode - utf8 - quoted-printable
This commit is contained in:
		
							parent
							
								
									3938254b36
								
							
						
					
					
						commit
						8fc3b8e3aa
					
				
					 20 changed files with 115 additions and 130 deletions
				
			
		
							
								
								
									
										38
									
								
								config/webpack.prod.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								config/webpack.prod.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | ||||||
|  | var webpack = require('webpack'); | ||||||
|  | var webpackMerge = require('webpack-merge'); | ||||||
|  | var ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||||||
|  | var commonConfig = require('./webpack.common.js'); | ||||||
|  | var helpers = require('./helpers'); | ||||||
|  | 
 | ||||||
|  | const ENV = process.env.NODE_ENV = process.env.ENV = 'production'; | ||||||
|  | 
 | ||||||
|  | module.exports = webpackMerge(commonConfig, { | ||||||
|  |     devtool: 'source-map', | ||||||
|  | 
 | ||||||
|  |     output: { | ||||||
|  |         path: helpers.root('dist'), | ||||||
|  |         publicPath: '/', | ||||||
|  |         filename: '[name].[hash].js', | ||||||
|  |         chunkFilename: '[id].[hash].chunk.js' | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     plugins: [ | ||||||
|  |         new webpack.NoEmitOnErrorsPlugin(), | ||||||
|  |         new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
 | ||||||
|  |             mangle: { | ||||||
|  |                 keep_fnames: true | ||||||
|  |             } | ||||||
|  |         }), | ||||||
|  |         new ExtractTextPlugin('[name].[hash].css'), | ||||||
|  |         new webpack.DefinePlugin({ | ||||||
|  |             'process.env': { | ||||||
|  |                 'ENV': JSON.stringify(ENV) | ||||||
|  |             } | ||||||
|  |         }), | ||||||
|  |         new webpack.LoaderOptionsPlugin({ | ||||||
|  |             htmlLoader: { | ||||||
|  |                 minimize: false // workaround for ng2
 | ||||||
|  |             } | ||||||
|  |         }) | ||||||
|  |     ] | ||||||
|  | }); | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| { | { | ||||||
|   "name": "dencode.org", |   "name": "dencode.org", | ||||||
|   "version": "1.0.0-alpha.1", |   "version": "1.0.0-alpha.2", | ||||||
|   "description": "Convert to and fro!", |   "description": "Convert to and fro!", | ||||||
|   "keywords": [ |   "keywords": [ | ||||||
|     "dencode", |     "dencode", | ||||||
|  | @ -13,8 +13,11 @@ | ||||||
|     "email": "manuel@fritteli.ch" |     "email": "manuel@fritteli.ch" | ||||||
|   }, |   }, | ||||||
|   "license": "MIT", |   "license": "MIT", | ||||||
|   "homepage": "https://test.friedli.info/~manuel/dencode", |   "homepage": "https://manuel.pages.gittr.ch/dencode.org", | ||||||
|   "repository": "https://gittr.ch/manuel/dencode.org.git", |   "repository": { | ||||||
|  |     "type": "git", | ||||||
|  |     "url": "https://gittr.ch/manuel/dencode.org.git" | ||||||
|  |   }, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@angular/common": "~2.4.0", |     "@angular/common": "~2.4.0", | ||||||
|     "@angular/compiler": "~2.4.0", |     "@angular/compiler": "~2.4.0", | ||||||
|  |  | ||||||
|  | @ -5,11 +5,12 @@ import {Converter} from "./converter/converter"; | ||||||
| import {NativeLibraryWrapperService} from "./nativelibrarywrapper.service"; | import {NativeLibraryWrapperService} from "./nativelibrarywrapper.service"; | ||||||
| import {Step} from "./step"; | import {Step} from "./step"; | ||||||
| 
 | 
 | ||||||
|  | import "../assets/css/style.css"; | ||||||
|  | 
 | ||||||
| @Component({ | @Component({ | ||||||
|     moduleId: module.id, |  | ||||||
|     selector: "den-app", |     selector: "den-app", | ||||||
|     templateUrl: "app.component.html", |     templateUrl: "./app.component.html", | ||||||
|     styleUrls: ["app.component.css"], |     styleUrls: ["./app.component.css"], | ||||||
|     providers: [ConverterRegistryService, InputComponentManagerService, NativeLibraryWrapperService] |     providers: [ConverterRegistryService, InputComponentManagerService, NativeLibraryWrapperService] | ||||||
| }) | }) | ||||||
| export class AppComponent extends OnInit { | export class AppComponent extends OnInit { | ||||||
|  |  | ||||||
|  | @ -15,6 +15,7 @@ export class PunycodeDecoder implements Converter { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     convert(input: string): string { |     convert(input: string): string { | ||||||
|         return this.nativeLibraryWrapperService.punycode.decode(input); |         // return this.nativeLibraryWrapperService.punycode.decode(input);
 | ||||||
|  |         return ""; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -15,6 +15,7 @@ export class PunycodeEncoder implements Converter { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     convert(input: string): string { |     convert(input: string): string { | ||||||
|         return this.nativeLibraryWrapperService.punycode.encode(input); |         // return this.nativeLibraryWrapperService.punycode.encode(input);
 | ||||||
|  |         return ""; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -14,10 +14,10 @@ export class QuotedPrintableDecoder implements Converter { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     convert(input:string):string { |     convert(input:string):string { | ||||||
|         try { |         // try {
 | ||||||
|             return this.nativeLibraryWrapperService.utf8.decode(this.nativeLibraryWrapperService.quotedPrintable.decode(input)); |         //     return this.nativeLibraryWrapperService.utf8.decode(this.nativeLibraryWrapperService.quotedPrintable.decode(input));
 | ||||||
|         } catch (error) { |         // } catch (error) {
 | ||||||
|             throw new Error("The input can not be interpreted as quoted-printable. May be corrupt?"); |             throw new Error("The input can not be interpreted as quoted-printable. May be corrupt?"); | ||||||
|         } |         // }
 | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -14,6 +14,7 @@ export class QuotedPrintableEncoder implements Converter { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     convert(input:string):string { |     convert(input:string):string { | ||||||
|         return this.nativeLibraryWrapperService.quotedPrintable.encode(this.nativeLibraryWrapperService.utf8.encode(input)); |         // return this.nativeLibraryWrapperService.quotedPrintable.encode(this.nativeLibraryWrapperService.utf8.encode(input));
 | ||||||
|  |         return ""; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -12,11 +12,11 @@ import {DecToHexConverter} from "./converter/dectohexconverter"; | ||||||
| import {HexToDecConverter} from "./converter/hextodecconverter"; | import {HexToDecConverter} from "./converter/hextodecconverter"; | ||||||
| import {DecToBinConverter} from "./converter/dectobinconverter"; | import {DecToBinConverter} from "./converter/dectobinconverter"; | ||||||
| import {BinToDecConverter} from "./converter/bintodecconverter"; | import {BinToDecConverter} from "./converter/bintodecconverter"; | ||||||
| import {QuotedPrintableDecoder} from "./converter/quotedprintabledecoder"; | // import {QuotedPrintableDecoder} from "./converter/quotedprintabledecoder";
 | ||||||
| import {QuotedPrintableEncoder} from "./converter/quotedprintableencoder"; | // import {QuotedPrintableEncoder} from "./converter/quotedprintableencoder";
 | ||||||
| import {NativeLibraryWrapperService} from "./nativelibrarywrapper.service"; | import {NativeLibraryWrapperService} from "./nativelibrarywrapper.service"; | ||||||
| import {PunycodeEncoder} from "./converter/punycodeencoder"; | // import {PunycodeEncoder} from "./converter/punycodeencoder";
 | ||||||
| import {PunycodeDecoder} from "./converter/punycodedecoder"; | // import {PunycodeDecoder} from "./converter/punycodedecoder";
 | ||||||
| 
 | 
 | ||||||
| @Injectable() | @Injectable() | ||||||
| export class ConverterRegistryService { | export class ConverterRegistryService { | ||||||
|  | @ -48,14 +48,14 @@ export class ConverterRegistryService { | ||||||
|         this.registerConverter(new URIComponentDecoder()); |         this.registerConverter(new URIComponentDecoder()); | ||||||
|         this.registerConverter(new HTMLEntitiesEncoder()); |         this.registerConverter(new HTMLEntitiesEncoder()); | ||||||
|         this.registerConverter(new HTMLEntitiesDecoder()); |         this.registerConverter(new HTMLEntitiesDecoder()); | ||||||
|         this.registerConverter(new QuotedPrintableEncoder(this.wrapper)); |         // this.registerConverter(new QuotedPrintableEncoder(this.wrapper));
 | ||||||
|         this.registerConverter(new QuotedPrintableDecoder(this.wrapper)); |         // this.registerConverter(new QuotedPrintableDecoder(this.wrapper));
 | ||||||
|         this.registerConverter(new DecToHexConverter()); |         this.registerConverter(new DecToHexConverter()); | ||||||
|         this.registerConverter(new HexToDecConverter()); |         this.registerConverter(new HexToDecConverter()); | ||||||
|         this.registerConverter(new DecToBinConverter()); |         this.registerConverter(new DecToBinConverter()); | ||||||
|         this.registerConverter(new BinToDecConverter()); |         this.registerConverter(new BinToDecConverter()); | ||||||
|         this.registerConverter(new PunycodeEncoder(this.wrapper)); |         // this.registerConverter(new PunycodeEncoder(this.wrapper));
 | ||||||
|         this.registerConverter(new PunycodeDecoder(this.wrapper)); |         // this.registerConverter(new PunycodeDecoder(this.wrapper));
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private registerConverter(converter:Converter):void { |     private registerConverter(converter:Converter):void { | ||||||
|  |  | ||||||
|  | @ -6,13 +6,13 @@ declare var punycode:any; | ||||||
| 
 | 
 | ||||||
| @Injectable() | @Injectable() | ||||||
| export class NativeLibraryWrapperService { | export class NativeLibraryWrapperService { | ||||||
|     public utf8:any; |     // public utf8:any;
 | ||||||
|     public quotedPrintable:any; |     // public quotedPrintable:any;
 | ||||||
|     public punycode:any; |     // public punycode:any;
 | ||||||
| 
 | 
 | ||||||
|     constructor() { |     constructor() { | ||||||
|         this.utf8 = utf8; |         // this.utf8 = utf8;
 | ||||||
|         this.quotedPrintable = quotedPrintable; |         // this.quotedPrintable = quotedPrintable;
 | ||||||
|         this.punycode = punycode; |         // this.punycode = punycode;
 | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										25
									
								
								src/assets/css/style.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/assets/css/style.css
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | ||||||
|  | @font-face { | ||||||
|  |     font-family: "ABeeZee"; | ||||||
|  |     font-stretch: normal; | ||||||
|  |     font-style: normal; | ||||||
|  |     font-variant: normal; | ||||||
|  |     font-weight: normal; | ||||||
|  |     src: local("ABeeZee Regular"), | ||||||
|  |     local("ABeeZee-Regular"), | ||||||
|  |     local("ABeeZee"), | ||||||
|  |     url("../fonts/abeezee-regular.woff") format("woff"); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | body { | ||||||
|  |     font-family: "ABeeZee", sans-serif; | ||||||
|  |     margin: 0; | ||||||
|  |     padding: 1em 0 0 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | h1 { | ||||||
|  |     text-align: center; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .apploader { | ||||||
|  |     text-align: center; | ||||||
|  | } | ||||||
| Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB | 
|  | @ -1,50 +1,9 @@ | ||||||
| <!DOCTYPE html> | <!DOCTYPE html> | ||||||
| <!-- |  | ||||||
|   ~ Copyright (C) Schweizerische Bundesbahnen SBB, 2017. |  | ||||||
|   --> |  | ||||||
| 
 |  | ||||||
| <html> | <html> | ||||||
| <head> | <head> | ||||||
|     <meta charset="UTF-8"/> |     <meta charset="UTF-8"/> | ||||||
|     <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/> |     <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/> | ||||||
|     <title>Decode? Encode? DENcode!</title> |     <title>Decode? Encode? DENcode!</title> | ||||||
|     <!--<script type="text/javascript" src="node_modules/core-js/client/shim.js"></script>--> |  | ||||||
|     <!--<script type="text/javascript" src="node_modules/zone.js/dist/zone.js"></script>--> |  | ||||||
|     <!--<script type="text/javascript" src="node_modules/reflect-metadata/Reflect.js"></script>--> |  | ||||||
|     <!--<script type="text/javascript" src="node_modules/systemjs/dist/system.src.js"></script>--> |  | ||||||
|     <!--<script type="text/javascript" src="node_modules/utf8/utf8.js"></script>--> |  | ||||||
|     <!--<script type="text/javascript" src="node_modules/quoted-printable/quoted-printable.js"></script>--> |  | ||||||
|     <!--<script type="text/javascript" src="node_modules/punycode/punycode.js"></script>--> |  | ||||||
| 
 |  | ||||||
|     <!--<script type="text/javascript" src="systemjs.config.js"></script>--> |  | ||||||
|     <!--<script type="text/javascript">--> |  | ||||||
|         <!--System.import("app").catch(function (err) {--> |  | ||||||
|             <!--console.log(err);--> |  | ||||||
|         <!--});--> |  | ||||||
|     <!--</script>--> |  | ||||||
|     <style> |  | ||||||
|         @font-face { |  | ||||||
|             font-family: "ABeeZee"; |  | ||||||
|             font-stretch: normal; |  | ||||||
|             font-style: normal; |  | ||||||
|             font-variant: normal; |  | ||||||
|             font-weight: normal; |  | ||||||
|             src: local("ABeeZee Regular"), |  | ||||||
|             local("ABeeZee-Regular"), |  | ||||||
|             local("ABeeZee"), |  | ||||||
|             url("abeezee-regular.woff") format("woff"); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         body { |  | ||||||
|             font-family: "ABeeZee", sans-serif; |  | ||||||
|             margin: 0; |  | ||||||
|             padding: 1em 0 0 0; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         h1 { |  | ||||||
|             text-align: center; |  | ||||||
|         } |  | ||||||
|     </style> |  | ||||||
| </head> | </head> | ||||||
| <body> | <body> | ||||||
| <h1>Decode? Encode? DENcode!</h1> | <h1>Decode? Encode? DENcode!</h1> | ||||||
|  | @ -53,7 +12,7 @@ | ||||||
|     Browser. You won't regret it! |     Browser. You won't regret it! | ||||||
| </noscript> | </noscript> | ||||||
| <den-app> | <den-app> | ||||||
|     <div style="text-align:center;">Please hold on, we're starting the turbines ...</div> |     <div class="apploader">Please hold on, we're starting the turbines ...</div> | ||||||
| </den-app> | </den-app> | ||||||
| </body> | </body> | ||||||
| </html> | </html> | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import "core-js/es6"; | import "core-js/es6"; | ||||||
| import "core-js/es7/reflect"; | import "core-js/es7/reflect"; | ||||||
| import "zone.js/dist/zone"; | import "zone.js/dist/zone"; | ||||||
| require('zone.js/dist/zone'); | require("zone.js/dist/zone"); | ||||||
| 
 | 
 | ||||||
| if (process.env.ENV === 'production') { | if (process.env.ENV === 'production') { | ||||||
|     // Production
 |     // Production
 | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ | ||||||
|       "dom" |       "dom" | ||||||
|     ], |     ], | ||||||
|     "noImplicitAny": true, |     "noImplicitAny": true, | ||||||
|     "suppressImplicitAnyIndexErrors": true |     "suppressImplicitAnyIndexErrors": true, | ||||||
|  |     "typeRoots": [ | ||||||
|  |       "../node_modules/@types/" | ||||||
|  |     ] | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,17 +1,13 @@ | ||||||
| import "@angular/core"; | import {Component, Injectable, NgModule, OnInit} from "@angular/core"; | ||||||
| import "@angular/platform-browser"; | import {BrowserModule} from "@angular/platform-browser"; | ||||||
| import "@angular/platform-browser-dynamic"; | import {platformBrowserDynamic} from "@angular/platform-browser-dynamic"; | ||||||
| import "@angular/forms"; | import {FormsModule} from "@angular/forms"; | ||||||
| // import {Component, Injectable, NgModule, OnInit} from "@angular/core";
 |  | ||||||
| // import {BrowserModule} from "@angular/platform-browser";
 |  | ||||||
| // import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
 |  | ||||||
| // import {FormsModule} from "@angular/forms";
 |  | ||||||
| 
 | 
 | ||||||
| // // Angular
 | import "rxjs"; | ||||||
| // import '@angular/platform-browser-dynamic';
 | 
 | ||||||
| // import '@angular/common';
 | import "utf8"; | ||||||
| // import '@angular/http';
 | import "quoted-printable"; | ||||||
| // import '@angular/router';
 | import "punycode"; | ||||||
| //
 | require("utf8"); | ||||||
| // // RxJS
 | require("quoted-printable"); | ||||||
| // import 'rxjs';
 | require("punycode"); | ||||||
|  |  | ||||||
|  | @ -1,43 +0,0 @@ | ||||||
| /** |  | ||||||
|  * System configuration for Angular 2 samples |  | ||||||
|  * Adjust as necessary for your application needs. |  | ||||||
|  */ |  | ||||||
| (function (global) { |  | ||||||
|     System.config({ |  | ||||||
|         paths: { |  | ||||||
|             // paths serve as alias
 |  | ||||||
|             'npm:': 'node_modules/' |  | ||||||
|         }, |  | ||||||
|         // map tells the System loader where to look for things
 |  | ||||||
|         map: { |  | ||||||
|             // our app is within the app folder
 |  | ||||||
|             app: 'app', |  | ||||||
|             // angular bundles
 |  | ||||||
|             '@angular/core': 'npm:@angular/core/bundles/core.umd.js', |  | ||||||
|             '@angular/common': 'npm:@angular/common/bundles/common.umd.js', |  | ||||||
|             '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', |  | ||||||
|             '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', |  | ||||||
|             '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', |  | ||||||
| //            '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
 |  | ||||||
| //            '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
 |  | ||||||
|            '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', |  | ||||||
|             // other libraries
 |  | ||||||
|             'rxjs': 'npm:rxjs'//,
 |  | ||||||
| //            'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',
 |  | ||||||
|         }, |  | ||||||
|         // packages tells the System loader how to load when no filename and/or no extension
 |  | ||||||
|         packages: { |  | ||||||
|             app: { |  | ||||||
|                 main: './main.js', |  | ||||||
|                 defaultExtension: 'js' |  | ||||||
|             }, |  | ||||||
|             rxjs: { |  | ||||||
|                 defaultExtension: 'js' |  | ||||||
|             }, |  | ||||||
|             'angular2-in-memory-web-api': { |  | ||||||
|                 main: './index.js', |  | ||||||
|                 defaultExtension: 'js' |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     }); |  | ||||||
| })(this); |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue