Skip to content

Commit

Permalink
Reverted ES2015 module attempt
Browse files Browse the repository at this point in the history
Merge branch 'v4'
I was attempting to use ES2015 modules.
It turns out that modules still do not work
for browsers and node.js at the same time.
The javascript community calls these 'isomorphic'
modules, and it is still not possible with
the new ECMA modules.

It turns out my old solution for that still works
so I am reverting to that.
  • Loading branch information
drudru committed Feb 9, 2019
2 parents dc92bdc + b8c6151 commit c285080
Show file tree
Hide file tree
Showing 8 changed files with 606 additions and 155 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ REPORTER = dot

typescript:
./node_modules/.bin/tsc -p .
cat ./umd.header ./dist/ansi_up.js ./umd.footer > ansi_up.js
mv ./dist/ansi_up.js ./dist/ansi_up.js.include
node ./scripts/fix-typings.js

test:
@NODE_ENV=test ./node_modules/.bin/mocha \
Expand Down
5 changes: 2 additions & 3 deletions ansi_up.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface TextPacket {
text: string;
url: string;
}
declare class AnsiUp {
export declare class AnsiUp {
VERSION: string;
private ansi_colors;
private palette_256;
Expand Down Expand Up @@ -50,5 +50,4 @@ declare class AnsiUp {
transform_to_html(fragment: TextWithAttr): string;
private process_hyperlink;
}
declare function rgx(tmplObj: any, ...subst: any[]): RegExp;
declare function rgxG(tmplObj: any, ...subst: any[]): RegExp;
export {};
294 changes: 146 additions & 148 deletions ansi_up.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ansi_up.js.map

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions dist/ansi_up.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
export interface AU_Color {
rgb: number[];
class_name: string;
}
export interface TextWithAttr {
fg: AU_Color;
bg: AU_Color;
bold: boolean;
text: string;
}
declare enum PacketKind {
EOS = 0,
Text = 1,
Incomplete = 2,
ESC = 3,
Unknown = 4,
SGR = 5,
OSCURL = 6
}
export interface TextPacket {
kind: PacketKind;
text: string;
url: string;
}
export default class AnsiUp {
VERSION: string;
private ansi_colors;
private palette_256;
private fg;
private bg;
private bold;
private _use_classes;
private _escape_for_html;
private _csi_regex;
private _osc_st;
private _osc_regex;
private _url_whitelist;
private _buffer;
constructor();
use_classes: boolean;
escape_for_html: boolean;
url_whitelist: {};
private setup_palettes;
private escape_txt_for_html;
append_buffer(txt: string): void;
get_next_packet(): TextPacket;
ansi_to_html(txt: string): string;
private with_state;
private process_ansi;
transform_to_html(fragment: TextWithAttr): string;
private process_hyperlink;
}
declare function rgx(tmplObj: any, ...subst: any[]): RegExp;
declare function rgxG(tmplObj: any, ...subst: any[]): RegExp;
395 changes: 395 additions & 0 deletions dist/ansi_up.js.include

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/ansi_up.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"compilerOptions": {
"target": "es6",
"target": "es5",
"module": "none",
"noEmitOnError": false,
"noEmitOnError": true,
"removeComments": true,
"sourceMap": true,
"declaration": true,
"noImplicitUseStrict": true
"noImplicitUseStrict": true,
"outDir": "dist"
},
"exclude": [ "node_modules", "dist" ]
}

0 comments on commit c285080

Please sign in to comment.