bufrw
bufrw copied to clipboard
Server-side bundling fails due to octals in ansi-color
When trying to use bufrw
(via thriftrw
) in an environment where server side code is bundled with Babel and Webpack, the build process throws an error related to using Octal literals in strict mode:
error: ./node_modules/ansi-color/lib/ansi-color.js
Module build failed (from ./node_modules/fusion-cli/build/loaders/babel-loader.js):
SyntaxError: /var/tmp/project/node_modules/ansi-color/lib/ansi-color.js: Octal literal in strict mode (35:18)
33 | var ansi_str = "";
34 | for(var i=0, attr; attr = color_attrs[i]; i++) {
> 35 | ansi_str += "\033[" + ANSI_CODES[attr] + "m";
| ^
36 | }
37 | ansi_str += str + "\033[" + ANSI_CODES["off"] + "m";
38 | return ansi_str;
at Parser.raise (/var/tmp/project/node_modules/@babel/parser/lib/index.js:6322:17)
at Parser.readEscapedChar (/var/tmp/project/node_modules/@babel/parser/lib/index.js:7418:20)
at Parser.readString (/var/tmp/project/node_modules/@babel/parser/lib/index.js:7265:21)
at Parser.getTokenFromCode (/var/tmp/project/node_modules/@babel/parser/lib/index.js:6950:14)
at Parser.nextToken (/var/tmp/project/node_modules/@babel/parser/lib/index.js:6520:12)
at Parser.next (/var/tmp/project/node_modules/@babel/parser/lib/index.js:6460:10)
at Parser.parseMaybeAssign (/var/tmp/project/node_modules/@babel/parser/lib/index.js:8210:12)
at Parser.parseExpression (/var/tmp/project/node_modules/@babel/parser/lib/index.js:8120:23)
at Parser.parseStatementContent (/var/tmp/project/node_modules/@babel/parser/lib/index.js:9892:23)
at Parser.parseStatement (/var/tmp/project/node_modules/@babel/parser/lib/index.js:9763:17)
at Parser.parseBlockOrModuleBlockBody (/var/tmp/project/node_modules/@babel/parser/lib/index.js:10340:25)
at Parser.parseBlockBody (/var/tmp/project/node_modules/@babel/parser/lib/index.js:10327:10)
at Parser.parseBlock (/var/tmp/project/node_modules/@babel/parser/lib/index.js:10311:10)
at Parser.parseStatementContent (/var/tmp/project/node_modules/@babel/parser/lib/index.js:9839:21)
at Parser.parseStatement (/var/tmp/project/node_modules/@babel/parser/lib/index.js:9763:17)
at node.body.withTopicForbiddingContext (/var/tmp/project/node_modules/@babel/parser/lib/index.js:10374:60)
@ ./node_modules/bufrw/error_highlighter.js 22:12-33
@ ./node_modules/bufrw/interface.js
@ ./node_modules/bufrw/index.js
@ ./node_modules/thriftrw/index.js
@ ./src/server/lib/thrift-http.js
@ ./src/server/app.js
Are you open to a PR replacing the use of ansi-color
with ansi-colors
or chalk
?