From bb3de411be714e3ea7620641b316cc537238e375 Mon Sep 17 00:00:00 2001 From: austincheney Date: Fri, 19 Apr 2019 10:40:16 +0300 Subject: [PATCH 1/7] working on next major version --- beautify/markup.ts | 2 + documentation.xhtml | 4 +- index.d.ts | 16 +- index.xhtml | 6 +- mode.ts | 70 +- package-lock.json | 6 +- package.json | 4 +- prettydiff-webtool.ts | 37 +- readme.md | 18 +- services.ts => terminal.ts | 619 +++++++++--------- tests/browser-demo.js | 4 +- tests/browser.html | 13 +- ...autify_script_language-jsx_scriptStart.txt | 31 + ...autify_script_language-jsx_scriptStart.txt | 24 + 14 files changed, 481 insertions(+), 373 deletions(-) rename services.ts => terminal.ts (92%) create mode 100644 tests/formatted/beautify_script_language-jsx_scriptStart.txt create mode 100644 tests/raw/beautify_script_language-jsx_scriptStart.txt diff --git a/beautify/markup.ts b/beautify/markup.ts index 0b03c0de..dec166fe 100644 --- a/beautify/markup.ts +++ b/beautify/markup.ts @@ -450,6 +450,8 @@ } } else if (data.types[a] === "start" && data.types[next] === "end") { level.push(-20); + } else if (data.types[a] === "start" && data.types[next] === "script_start") { + level.push(-10); } else if (options.force_indent === true) { level.push(indent); } else if (data.types[a] === "template_start" && data.types[next] === "template_end") { diff --git a/documentation.xhtml b/documentation.xhtml index 59155a14..9fba4296 100644 --- a/documentation.xhtml +++ b/documentation.xhtml @@ -16,7 +16,7 @@ rel="meta" title="ICRA labels" type="application/rdf+xml"/> - + @@ -373,6 +373,6 @@ - + \ No newline at end of file diff --git a/index.d.ts b/index.d.ts index c95313f8..c37ca701 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,6 +1,6 @@ -declare var options: any; declare var ace: any; -declare var prettydiff: any; +declare var options: any; +declare var prettydiff: pd; declare var window: Window; declare module NodeJS { interface Global { @@ -155,7 +155,6 @@ interface optionDef { } interface optionFunctions { definitions?: {}; - } interface performance { codeLength: number; @@ -167,6 +166,17 @@ interface performance { store: number[]; test: boolean; } +interface pd { + (meta?): string; + api: any; + beautify: any; + iterator: number; + meta: meta; + minify: any; + options: any, + saveAs?: Function; + scopes: scriptScopes; +} interface readDirectory { callback: Function; exclusions: string[]; diff --git a/index.xhtml b/index.xhtml index 5ef66746..2ba75d58 100644 --- a/index.xhtml +++ b/index.xhtml @@ -9,7 +9,7 @@ - +
-

Latest Commit:2 Apr 2019 Version: 100.3.1 +

Latest Commit:2 Apr 2019 Version: 101.0.0

@@ -363,6 +363,6 @@ - + diff --git a/mode.ts b/mode.ts index eee388d3..c457df21 100644 --- a/mode.ts +++ b/mode.ts @@ -1,13 +1,14 @@ /*global global, window*/ (function mode_init() { "use strict"; - const mode = function mode_(options:any, diffmeta?:diffmeta):string { - let globalAPI:any = (options.api === "dom") + const pd = function prettydiff_(diffmeta?:diffmeta):string { + let options = pd.options, + globalAPI:any = (options.api === "dom") ? window : global, modeValue:"beautify"|"minify" = options.mode, result:string = ""; - const pdcomment = function mode_pdcomment(options:any):void { + const pdcomment = function mode_pdcomment():void { const ops:any = globalAPI.sparser.options; let sindex:number = options.source.search(/((\/(\*|\/))|", - injectFlag: `${versionData.date} Version: ${versionData.number}`, + injectFlag: `${prettydiff.version.date} Version: ${prettydiff.version.number}`, start: "" }); data = data.replace(/(\.css\?\d*)/g, `.css?${date}`).replace(/(\.js\?\d*)/g, `.js?${date}`); @@ -1292,17 +1288,10 @@ interface readFile { start: "// prettydiff dom insertion start" }); webtool = `${parser + data.replace(/("|')use strict("|');/g, "").replace(/window\.sparser/g, "sparser")}}());`; - } else if (fileFlag === "terminal") { - modify({ - end: "// node version end", - injectFlag: `version=${JSON.stringify(versionData)},`, - start:"// node version start" - }); - terminal = data; } flag[fileFlag] = true; - if (flag.documentation === true && flag.html === true && flag.terminal === true && flag.webtool === true) { - let thirdparty:string = parser.replace(/const\s+parser\s*=/, "let prettydiff={};const parse=") + libraries; + if (flag.documentation === true && flag.html === true && flag.webtool === true) { + let thirdparty:string = `${parser.replace(/const\s+parser\s*=/, "let prettydiff={};const parser=") + libraries}prettydiff.api.language=sparser.libs.language;prettydiff.version=${JSON.stringify(prettydiff.version)};`; node.fs.writeFile(`${js}prettydiff.js`, `${thirdparty}module.exports=prettydiff;return prettydiff;}());`, function node_apps_build_libraries_modifyFile_read_write_readParser_writeBrowser(erbr:Error) { if (erbr !== null && erbr.toString() !== "") { apps.errout([erbr.toString()]); @@ -1318,13 +1307,7 @@ interface readFile { apps.errout([erwb.toString()]); return; } - node.fs.writeFile(`${js}services.js`, terminal, function node_apps_build_libraries_modifyFile_read_write_readParser_writeBrowser_writePrettydiff_writeWebtool_writeTerminal(ertr:Error) { - if (ertr !== null && ertr.toString() !== "") { - apps.errout([ertr.toString()]); - return; - } - next(`${text.green}Application files built and written.${text.none}`); - }); + next(`${text.green}Application files built and written.${text.none}`); }); }); }); @@ -1334,7 +1317,7 @@ interface readFile { libraryFiles = function node_apps_build_libraries_libraryFiles() { libFiles.push(`${projectPath}node_modules${sep}file-saver${sep}FileSaver.min.js`); libFiles.push(`${projectPath}node_modules${sep}sparser${sep}js${sep}browser.js`); - libFiles.push(`${projectPath}node_modules${sep}sparser${sep}js${sep}libs${sep}language.js`); + libFiles.push(`${js}mode.js`); const appendFile = function node_apps_build_libraries_libraryFiles_appendFile(filePath:string):void { node.fs.readFile(filePath, "utf8", function node_apps_build_libraries_libraryFiles_appendFile_read(errr:Error, filedata:string):void { const filenames:string[] = filePath.split(sep), @@ -1363,12 +1346,11 @@ interface readFile { .replace(/(\/\*global\s+global(,\s*options)?(,\s*prettydiff)?\s*\*\/\s*)/, "") .replace(/global\s*\.\s*prettydiff\s*\./g, "prettydiff.") .replace(/("|')use strict("|');/, ""); - if (filename === "language.js" && filePath.indexOf(filename) === filePath.length - filename.length) { - libraries = libraries + filedata.replace("global.sparser.libs.language", "prettydiff.api.language"); - } else if (filename === "mode.js" && filePath.indexOf(filename) === filePath.length - filename.length) { + if (filename === "mode.js" && filePath.indexOf(filename) === filePath.length - filename.length) { mode = filedata .replace(/global(API)?\./g, "") - .replace(/\/\*global\s+global(\s*,\s*window)?\*\//, "") + .replace(/\/\*global\s+global(\s*,\s*prettydiff)?(\s*,\s*window)?\*\//, "") + .replace(/globalAPI\.sparser/g, "sparser") .replace(/globalAPI\s*=\s*\(options\.api\s*===\s*"dom"\)\s*\?\s*window\s*:\s*global,/, "") .replace(/if\s*\(options\.api\s*===\s*"dom"\)\s*\{\s*globalAPI\s*=\s*window;\s*\}/, "") .replace(/,\s*\/\/\s*prettydiff file insertion start\s+prettydiff\s*=\s*\{\};/, ";") @@ -1381,7 +1363,6 @@ interface readFile { a = a + 1; if (a === filelen) { libraries = mode + libraries; - modifyFile(`${js}terminal.js`, "terminal"); modifyFile(`${projectPath}index.xhtml`, "html"); modifyFile(`${js}prettydiff-webtool.js`, "webtool"); modifyFile(`${projectPath}documentation.xhtml`, "documentation"); @@ -1423,32 +1404,25 @@ interface readFile { return; } const date:string[] = stderr.slice(stderr.indexOf("Date:") + 12).split(" "); - versionData.date = `${date[1]} ${date[0]} ${date[3]}`; + prettydiff.version.date = `${date[1]} ${date[0]} ${date[3]}`; node.fs.readFile(`${projectPath}package.json`, "utf8", function node_apps_build_libraries_versionGather_child_readPackage(errp:Error, data:string):void { if (errp !== null) { apps.errout([errp.toString()]); return; } - versionData.number = JSON.parse(data).version; + prettydiff.version.number = JSON.parse(data).version; node.fs.readFile(`${projectPath}node_modules${sep}sparser${sep}package.json`, "utf8", function node_apps_build_libraries_versionGather_child_readPackage_readSparser(errf:Error, frameData:string):void { if (errf !== null) { apps.errout([errf.toString()]); return; } - versionData.parse = JSON.parse(frameData).version; + prettydiff.version.parse = JSON.parse(frameData).version; // update information for display in current build - version.date = versionData.date; - version.number = versionData.number; - version.parse = versionData.parse; defaults = (function node_apps_build_libraries_modifyFile_read_buildDefault():string { const obj:any = {}; - let a:number = 0, - apikey = ""; + let a:number = 0; do { - apikey = prettydiff.api.optionDef[optkeys[a]].api; - if (apikey === "any" || apikey === api) { - obj[optkeys[a]] = prettydiff.api.optionDef[optkeys[a]].default; - } + obj[optkeys[a]] = prettydiff.api.optionDef[optkeys[a]].default; a = a + 1; } while (a < keyslen); obj.lexerOptions = {}; @@ -2962,8 +2936,8 @@ interface readFile { }); if (verbose === true) { console.log(""); - console.log(`Sparser version ${text.angry + version.parse + text.none}`); - console.log(`Pretty Diff version ${text.angry + version.number + text.none} dated ${text.cyan + version.date + text.none}`); + console.log(`Sparser version ${text.angry + prettydiff.version.parse + text.none}`); + console.log(`Pretty Diff version ${text.angry + prettydiff.version.number + text.none} dated ${text.cyan + prettydiff.version.date + text.none}`); apps.humantime(true); } }; @@ -3363,8 +3337,6 @@ interface readFile { return; } const readmethod:string = options.read_method, - //auto:boolean = (readmethod === "auto"), - all = require(`${projectPath}node_modules${sep}sparser${sep}js${sep}lexers${sep}all`), item:string = (diff === true) ? "diff" : "source", @@ -3842,12 +3814,7 @@ interface readFile { } }); }; - if (global.sparser === undefined) { - require(`${projectPath}node_modules${sep}sparser${sep}js${sep}parse`); - } - all(options, function node_apps_readmethod_allLexers() { - resolve(); - }); + resolve(); }; // similar to posix "rm -rf" command apps.remove = function node_apps_remove(filepath:string, callback:Function):void { From 73092c0035aa3b41a0f65c6cae9a36dd4fc1664b Mon Sep 17 00:00:00 2001 From: austincheney Date: Sun, 21 Apr 2019 09:39:39 +0300 Subject: [PATCH 4/7] build working for node, but I still need to tweak it for the web tool --- api/mode.ts | 769 +++++++++++++++++ api/optionDef.ts | 21 - .../prettydiff-webtool.ts | 0 beautify/markup.ts | 16 +- beautify/script.ts | 26 +- beautify/style.ts | 8 +- index.d.ts | 2 + minify/markup.ts | 18 +- minify/script.ts | 14 +- minify/style.ts | 8 +- mode.ts | 783 ------------------ options.md | 22 - services.ts | 156 +--- tests/simulations.ts | 2 +- 14 files changed, 855 insertions(+), 990 deletions(-) create mode 100644 api/mode.ts rename prettydiff-webtool.ts => api/prettydiff-webtool.ts (100%) delete mode 100644 mode.ts diff --git a/api/mode.ts b/api/mode.ts new file mode 100644 index 00000000..d0faa5d6 --- /dev/null +++ b/api/mode.ts @@ -0,0 +1,769 @@ +/*global global, prettydiff, window*/ +function mode(diffmeta?:diffmeta):string { + "use strict"; + const pdcomment = function mode_pdcomment():void { + const ops:any = globalAPI.sparser.options; + let sindex:number = options.source.search(/((\/(\*|\/))| + // + // + // - Parsing Considerations: + // * there may be any amount of space at the start or end of the comment + // * "prettydiff.com" must exist at the start of the comment + // * comment must exist prior to non-comment tokens (near top of code) + // * parameters are name value pairs separated by white space + // * the delimiter separating name and value is either ":" or "=" characters + + if ((sindex > -1 && (sindex === 0 || "\"':".indexOf(options.source.charAt(sindex - 1)) < 0)) || (options.mode === "diff" && dindex > -1 && (dindex === 0 || "\"':".indexOf(options.diff.charAt(dindex - 1)) < 0))) { + let pdcom:number = sindex, + a:number = (pdcom > -1) + ? pdcom + : dindex, + b:number = 0, + quote:string = "", + item:string = "", + lang:string = "", + lex:string = "", + valkey:string[] = [], + op:string[] = []; + const ops:string[] = [], + source:string = (pdcom > -1) + ? options.source + : options.diff, + len:number = source.length, + comment:string = (source.charAt(a) === "<") + ? "") { + break; + } + if (comment === "//" && source.charAt(a) === "\n") { + break; + } + if (comment === "/\u002a" && source.slice(a - 1, a + 1) === "\u002a/") { + break; + } + } else if (source.charAt(a) === quote && quote !== "${") { + quote = ""; + } else if (quote === "`" && source.slice(a, a + 2) === "${") { + quote = "${"; + } else if (quote === "${" && source.charAt(a) === "}") { + quote = "`"; + } + } + a = a + 1; + } while (a < len); + if (b > 0) { + quote = source.slice(b, a + 1); + if (comment === " - // - // - // - Parsing Considerations: - // * there may be any amount of space at the start or end of the comment - // * "prettydiff.com" must exist at the start of the comment - // * comment must exist prior to non-comment tokens (near top of code) - // * parameters are name value pairs separated by white space - // * the delimiter separating name and value is either ":" or "=" characters - - if ((sindex > -1 && (sindex === 0 || "\"':".indexOf(options.source.charAt(sindex - 1)) < 0)) || (options.mode === "diff" && dindex > -1 && (dindex === 0 || "\"':".indexOf(options.diff.charAt(dindex - 1)) < 0))) { - let pdcom:number = sindex, - a:number = (pdcom > -1) - ? pdcom - : dindex, - b:number = 0, - quote:string = "", - item:string = "", - lang:string = "", - lex:string = "", - valkey:string[] = [], - op:string[] = []; - const ops:string[] = [], - source:string = (pdcom > -1) - ? options.source - : options.diff, - len:number = source.length, - comment:string = (source.charAt(a) === "<") - ? "") { - break; - } - if (comment === "//" && source.charAt(a) === "\n") { - break; - } - if (comment === "/\u002a" && source.slice(a - 1, a + 1) === "\u002a/") { - break; - } - } else if (source.charAt(a) === quote && quote !== "${") { - quote = ""; - } else if (quote === "`" && source.slice(a, a + 2) === "${") { - quote = "${"; - } else if (quote === "${" && source.charAt(a) === "}") { - quote = "`"; - } - } - a = a + 1; - } while (a < len); - if (b > 0) { - quote = source.slice(b, a + 1); - if (comment === "
  • brace_line

    • Description
      If true an empty line will be inserted after opening curly braces and before closing curly braces.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Brace Lines
  • brace_padding

    • Description
      Inserts a space after the start of a container and before the end of the container if the contents of that container are not indented; such as: conditions, function arguments, and escaped sequences of template strings.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Brace Padding
  • brace_style

    • Description
      Emulates JSBeautify's brace_style option using existing Pretty Diff options.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      script
    • Accepted Values
      collapse
      Sets options.format_object to 'indent' and options.neverflatten to true.
      collapse-preserve-inline
      Sets options.bracepadding to true and options.format_object to 'inline'.
      expand
      Sets options.braces to true, options.format_object to 'indent', and options.neverflatten to true.
      none
      Ignores this option
    • Default
      none
    • As labeled in the HTML tool
      Brace Style
  • braces

    • Description
      Determines if opening curly braces will exist on the same line as their condition or be forced onto a new line.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Style of Indent
  • color

    • Description
      The color scheme of the reports.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Accepted Values
      canvas
      A light brown color scheme
      shadow
      A black and ashen color scheme
      white
      A white and pale grey color scheme
    • Default
      white
    • As labeled in the HTML tool
      Color
  • comment_line

    • Description
      If a blank new line should be forced above comments.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Force an Empty Line Above Comments
  • comments

    • Description
      This will determine whether comments should always start at position 0 of each line or if comments should be indented according to the code.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Indent Comments
  • complete_document

    • Description
      Allows a preference for generating a complete HTML document instead of only generating content.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Generate A Complete HTML File
  • compressed_css

    • Description
      If CSS should be beautified in a style where the properties and values are minifed for faster reading of selectors.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      style
    • Default
      false
    • As labeled in the HTML tool
      Compressed CSS
  • conditional

    • Description
      If true then conditional comments used by Internet Explorer are preserved at minification of markup.
    • Environment
      any
    • Type
      boolean
    • Mode
      minify
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      IE Comments (HTML Only)
  • content

    • Description
      This will normalize all string content to 'text' so as to eliminate some differences from the output.
    • Environment
      any
    • Type
      boolean
    • Mode
      diff
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Ignore Content
  • correct

    • Description
      Automatically correct some sloppiness in code.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Fix Sloppy Code
  • crlf

    • Description
      If line termination should be Windows (CRLF) format. Unix (LF) format is the default.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Line Termination
  • css_insert_lines

    • Description
      Inserts new line characters between every CSS code block.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      style
    • Default
      false
    • As labeled in the HTML tool
      Insert Empty Lines
  • diff

    • Description
      The code sample to be compared to 'source' option. This is required if mode is 'diff'.
    • Environment
      any
    • Type
      string
    • Mode
      diff
    • Lexer
      any
    • Default
    • As labeled in the HTML tool
      Code to Compare
  • diff_comments

    • Description
      If true then comments will be preserved so that both code and comments are compared by the diff engine.
    • Environment
      any
    • Type
      boolean
    • Mode
      diff
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Code Comments
  • diff_context

    • Description
      This shortens the diff output by allowing a specified number of equivalent lines between each line of difference. This option is only used with diff_format:html.
    • Environment
      any
    • Type
      number
    • Mode
      diff
    • Lexer
      any
    • Default
      -1
    • As labeled in the HTML tool
      Context Size
  • diff_format

    • Description
      The format of the output. The command line output format is text, similar to Unix 'diff'.
    • Environment
      any
    • Type
      string
    • Mode
      diff
    • Lexer
      any
    • Accepted Values
      html
      An HTML format for embedding in web pages, or as a complete web page if document_complete is true.
      json
      A JSON format.
      text
      Formatted similar to the Unix 'diff' command line utility.
    • Default
      text
    • As labeled in the HTML tool
      Diff Format
  • diff_label

    • Description
      This allows for a descriptive label for the diff file code of the diff HTML output.
    • Environment
      any
    • Type
      string
    • Mode
      diff
    • Lexer
      any
    • Default
      New Sample
    • As labeled in the HTML tool
      Label for Diff Sample
  • diff_rendered_html

    • Description
      Compares complete HTML documents and injects custom CSS so that the differences display not in the code, but in the rendered page in a browser. This option is currently confined only to markup languages, read_method file, and mode diff. Option diff_format is ignored.
    • Environment
      any
    • Type
      boolean
    • Mode
      diff
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Compare Rendered HTML
  • diff_space_ignore

    • Description
      If white space only differences should be ignored by the diff tool.
    • Environment
      any
    • Type
      boolean
    • Mode
      diff
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Remove White Space
  • diff_view

    • Description
      This determines whether the diff HTML output should display as a side-by-side comparison or if the differences should display in a single table column.
    • Environment
      any
    • Type
      string
    • Mode
      diff
    • Lexer
      any
    • Accepted Values
      inline
      A single column where insertions and deletions are vertically adjacent.
      sidebyside
      Two column comparison of changes.
    • Default
      sidebyside
    • As labeled in the HTML tool
      Diff View Type
  • else_line

    • Description
      If else_line is true then the keyword 'else' is forced onto a new line.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Else On New Line
  • end

    • Description
      The last index to process. This option is useful internally when recursively sliding between various libraries. The default value of 0 means to ignore this option.
    • Environment
      any
    • Type
      number
    • Mode
      any
    • Lexer
      any
    • Default
      0
    • As labeled in the HTML tool
      End Index
  • end_comma

    • Description
      If there should be a trailing comma in arrays and objects. Value "multiline" only applies to modes beautify and diff.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      script
    • Accepted Values
      always
      Always ensure there is a tailing comma
      never
      Remove trailing commas
      none
      Ignore this option
    • Default
      never
    • As labeled in the HTML tool
      Trailing Comma
  • end_quietly

    • Description
      A node only option to determine if terminal summary data should be logged to the console.
    • Environment
      node
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Accepted Values
      default
      Default minimal summary
      log
      Verbose logging
      quiet
      No extraneous logging
    • Default
      default
    • As labeled in the HTML tool
      Log Summary to Console
  • force_attribute

    • Description
      If all markup attributes should be indented each onto their own line.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Force Indentation of All Attributes
  • force_indent

    • Description
      Will force indentation upon all content and tags without regard for the creation of new text nodes.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Force Indentation of All Content
  • format_array

    • Description
      Determines if all array indexes should be indented, never indented, or left to the default.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      script
    • Accepted Values
      default
      Default formatting
      indent
      Always indent each index of an array
      inline
      Ensure all array indexes appear on a single line
    • Default
      default
    • As labeled in the HTML tool
      Formatting Arrays
  • format_object

    • Description
      Determines if all object keys should be indented, never indented, or left to the default.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      script
    • Accepted Values
      default
      Default formatting
      indent
      Always indent each key/value pair
      inline
      Ensure all key/value pairs appear on the same single line
    • Default
      default
    • As labeled in the HTML tool
      Formatting Objects
  • function_name

    • Description
      If a space should follow a JavaScript function name.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Space After Function Name
  • help

    • Description
      A node only option to print documentation to the console. The value determines where to wrap text.
    • Environment
      node
    • Type
      number
    • Mode
      any
    • Lexer
      any
    • Default
      80
    • As labeled in the HTML tool
      Help Wrapping Limit
  • indent_char

    • Description
      The string characters to comprise a single indentation. Any string combination is accepted.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      any
    • Default
    • As labeled in the HTML tool
      Indentation Characters
  • indent_level

    • Description
      How much indentation padding should be applied to beautification? This option is internally used for code that requires switching between libraries.
    • Environment
      any
    • Type
      number
    • Mode
      beautify
    • Lexer
      any
    • Default
      0
    • As labeled in the HTML tool
      Indentation Padding
  • indent_size

    • Description
      The number of 'inchar' values to comprise a single indentation.
    • Environment
      any
    • Type
      number
    • Mode
      beautify
    • Lexer
      any
    • Default
      4
    • As labeled in the HTML tool
      Indent Size
  • jsscope

    • Description
      An educational tool to generate HTML output of JavaScript code to identify scope regions and declared references by color. This option is ignored unless the code language is JavaScript or TypeScript.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      script
    • Accepted Values
      html
      generates HTML output with escaped angle braces and ampersands for embedding as code, which is handy in code producing tools
      none
      prevents use of this option
      report
      generates HTML output that renders in web browsers
    • Default
      none
    • As labeled in the HTML tool
      JavaScript Scope Identification
  • language

    • Description
      The lowercase single word common name of the source code's programming language. The value 'auto' imposes language and lexer auto-detection, which ignores deliberately specified lexer values. The value 'text' is converted to 'auto' if options 'mode' is not 'diff'. Value 'text' allows literal comparisons.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Default
      auto
    • As labeled in the HTML tool
      Language
  • language_default

    • Description
      The fallback option if option 'lang' is set to 'auto' and a language cannot be detected.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Default
      text
    • As labeled in the HTML tool
      Language Auto-Detection Default
  • language_name

    • Description
      The formatted proper name of the code sample's language for use in reports read by people.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Default
      JavaScript
    • As labeled in the HTML tool
      Formatted Name of the Code's Language
  • lexer

    • Description
      This option determines which sets of rules to use in the language parser. If option 'language' has a value of 'auto', which is the default value, this option is ignored. The value 'text' is converted to 'auto' if options 'mode' is not 'diff'. Value 'text' allows literal comparisons.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Accepted Values
      auto
      The value 'auto' imposes language and lexer auto-detection, which ignores deliberately specified language values.
      markup
      parses languages like XML and HTML
      script
      parses languages with a C style syntax, such as JavaScript
      style
      parses CSS like languages
    • Default
      auto
    • As labeled in the HTML tool
      Parsing Lexer
  • list_options

    • Description
      A Node.js only option that writes current option settings to the console.
    • Environment
      node
    • Type
      boolean
    • Mode
      any
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Options List
  • method_chain

    • Description
      When to break consecutively chained methods and properties onto separate lines. A negative value disables this option. A value of 0 ensures method chains are never broken.
    • Environment
      any
    • Type
      number
    • Mode
      beautify
    • Lexer
      script
    • Default
      3
    • As labeled in the HTML tool
      Method Chains
  • minify_keep_comments

    • Description
      Prevents minification from stripping out comments.
    • Environment
      any
    • Type
      boolean
    • Mode
      minify
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Keep Comments
  • minify_wrap

    • Description
      Whether minified script should wrap after a specified character width. This option requires a value from option 'wrap'.
    • Environment
      any
    • Type
      boolean
    • Mode
      minify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Minification Wrapping
  • mode

    • Description
      The operation to be performed.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Accepted Values
      beautify
      beautifies code and returns a string
      diff
      returns either command line list of differences or an HTML report
      minify
      minifies code and returns a string
      parse
      using option 'parseFormat' returns an object with shallow arrays, a multidimensional array, or an HTML report
    • Default
      diff
    • As labeled in the HTML tool
      Mode
  • never_flatten

    • Description
      If destructured lists in script should never be flattend.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Never Flatten Destructured Lists
  • new_line

    • Description
      Insert an empty line at the end of output.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      New Line at End of Code
  • no_case_indent

    • Description
      If a case statement should receive the same indentation as the containing switch block.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Case Indentation
  • no_lead_zero

    • Description
      Whether leading 0s in CSS values immediately preceeding a decimal should be removed or prevented.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      style
    • Default
      false
    • As labeled in the HTML tool
      Leading 0s
  • node_error

    • Description
      A Node.js only option if parse errors should be written to the console.
    • Environment
      node
    • Type
      boolean
    • Mode
      any
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Write Parse Errors in Node
  • object_sort

    • Description
      Sorts markup attributes and properties by key name in script and style.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Object/Attribute Sort
  • output

    • Description
      A file path for which to write output. If this option is not specified output will be printed to the shell.
    • Environment
      node
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Default
    • As labeled in the HTML tool
      Output Location
  • parse_format

    • Description
      Determines the output format for 'parse' mode.
    • Environment
      any
    • Type
      string
    • Mode
      parse
    • Lexer
      any
    • Accepted Values
      htmltable
      generates the 'table' type output for the DOM but escapes the HTML tags for rendering as HTML code in a HTML tool
      parallel
      returns an object containing series of parallel arrays
      sequential
      returns an array where each index is a child object containing the parsed token and all descriptive data
      table
      generates a colorful grid of output for either the dom or command line interface
    • Default
      parallel
    • As labeled in the HTML tool
      Parse Format
  • parse_space

    • Description
      Whether whitespace tokens should be included in markup parse output.
    • Environment
      any
    • Type
      boolean
    • Mode
      parse
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Retain White Space Tokens in Parse Output
  • preserve

    • Description
      The maximum number of consecutive empty lines to retain.
    • Environment
      any
    • Type
      number
    • Mode
      beautify
    • Lexer
      any
    • Default
      0
    • As labeled in the HTML tool
      Preserve Consecutive New Lines
  • preserve_comment

    • Description
      Prevent comment reformatting due to option wrap.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Eliminate Word Wrap Upon Comments
  • preserve_text

    • Description
      If text in the provided markup code should be preserved exactly as provided. This option eliminates beautification and wrapping of text content.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Preserve Markup Text White Space
  • quote

    • Description
      If true and mode is 'diff' then all single quote characters will be replaced by double quote characters in both the source and diff file input so as to eliminate some differences from the diff report HTML output.
    • Environment
      any
    • Type
      boolean
    • Mode
      diff
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Normalize Quotes
  • quote_convert

    • Description
      If the quotes of script strings or markup attributes should be converted to single quotes or double quotes.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Accepted Values
      double
      Converts single quotes to double quotes
      none
      Ignores this option
      single
      Converts double quotes to single quotes
    • Default
      none
    • As labeled in the HTML tool
      Indent Size
  • read_method

    • Description
      The option determines how Node.js should receive input. All output will be printed to the shell unless the option 'output' is specified, which will write output to a file.
    • Environment
      node
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Accepted Values
      auto
      changes to value subdirectory, file, or screen depending on source resolution
      directory
      process all files in the specified directory only
      file
      reads a file and outputs to a file. file requires option 'output'
      screen
      reads from screen and outputs to screen
      subdirectory
      process all files in a directory and its subdirectories
    • Default
      auto
    • As labeled in the HTML tool
      Read Method
  • selector_list

    • Description
      If comma separated CSS selectors should present on a single line of code.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      style
    • Default
      false
    • As labeled in the HTML tool
      Indent Size
  • semicolon

    • Description
      If true and mode is 'diff' and lang is 'javascript' all semicolon characters that immediately preceed any white space containing a new line character will be removed so as to elimate some differences from the code comparison.
    • Environment
      any
    • Type
      boolean
    • Mode
      diff
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Indent Size
  • source

    • Description
      The source code or location for interpretation. This option is required for all modes.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Default
    • As labeled in the HTML tool
      Source Sample
  • source_label

    • Description
      This allows for a descriptive label of the source file code for the diff HTML output.
    • Environment
      any
    • Type
      string
    • Mode
      diff
    • Lexer
      any
    • Default
      Source Sample
    • As labeled in the HTML tool
      Label for Source Sample
  • space

    • Description
      Inserts a space following the function keyword for anonymous functions.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      true
    • As labeled in the HTML tool
      Function Space
  • space_close

    • Description
      Markup self-closing tags end will end with ' />' instead of '/>'.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Close Markup Self-Closing Tags with a Space
  • start

    • Description
      The parse table index to start working from. This is internally used for code samples that require switching between different libraries.
    • Environment
      any
    • Type
      number
    • Mode
      any
    • Lexer
      any
    • Default
      0
    • As labeled in the HTML tool
      Start Index
  • styleguide

    • Description
      Provides a collection of option presets to easily conform to popular JavaScript style guides.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      script
    • Accepted Values
      airbnb
      https://github.com/airbnb/javascript
      crockford
      http://jslint.com/
      google
      https://google.github.io/styleguide/jsguide.html
      jquery
      https://contribute.jquery.org/style-guide/js/
      jslint
      http://jslint.com/
      mediawiki
      https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript
      mrdoob
      https://github.com/mrdoob/three.js/wiki/Mr.doob's-Code-Style%E2%84%A2
      none
      Ignores this option
      standard
      https://standardjs.com/
      yandex
      https://github.com/ymaps/codestyle/blob/master/javascript.md
    • Default
      none
    • As labeled in the HTML tool
      Script Styleguide
  • summary_only

    • Description
      Node only option to output only number of differences.
    • Environment
      node
    • Type
      boolean
    • Mode
      diff
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Output Diff Only Without A Summary
  • tag_merge

    • Description
      Allows immediately adjacement start and end markup tags of the same name to be combined into a single self-closing tag.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Merge Adjacent Start and End tags
  • tag_sort

    • Description
      Sort child items of each respective markup parent element.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Sort Markup Child Items
  • ternary_line

    • Description
      If ternary operators in JavaScript ? and : should remain on the same line.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Keep Ternary Statements On One Line
  • top_comments

    • Description
      If mode is 'minify' this determines whether comments above the first line of code should be kept.
    • Environment
      any
    • Type
      boolean
    • Mode
      minify
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Retain Comment At Code Start
  • unformatted

    • Description
      If markup tags should have their insides preserved. This option is only available to markup and does not support child tokens that require a different lexer.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Markup Tag Preservation
  • variable_list

    • Description
      If consecutive JavaScript variables should be merged into a comma separated list or if variables in a list should be separated.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      script
    • Accepted Values
      each
      Ensurce each reference is a single declaration statement.
      list
      Ensure consecutive declarations are a comma separated list.
      none
      Ignores this option.
    • Default
      none
    • As labeled in the HTML tool
      Variable Declaration Lists
  • version

    • Description
      A Node.js only option to write the version information to the console.
    • Environment
      node
    • Type
      boolean
    • Mode
      any
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Version
  • vertical

    • Description
      If lists of assignments and properties should be vertically aligned. This option is not used with the markup lexer.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Vertical Alignment
  • wrap

    • Description
      Character width limit before applying word wrap. A 0 value disables this option. A negative value concatenates script strings.
    • Environment
      any
    • Type
      number
    • Mode
      any
    • Lexer
      any
    • Default
      0
    • As labeled in the HTML tool
      Wrap
  • +
  • brace_line

    • Description
      If true an empty line will be inserted after opening curly braces and before closing curly braces.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Brace Lines
  • brace_padding

    • Description
      Inserts a space after the start of a container and before the end of the container if the contents of that container are not indented; such as: conditions, function arguments, and escaped sequences of template strings.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Brace Padding
  • brace_style

    • Description
      Emulates JSBeautify's brace_style option using existing Pretty Diff options.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      script
    • Accepted Values
      collapse
      Sets options.format_object to 'indent' and options.neverflatten to true.
      collapse-preserve-inline
      Sets options.bracepadding to true and options.format_object to 'inline'.
      expand
      Sets options.braces to true, options.format_object to 'indent', and options.neverflatten to true.
      none
      Ignores this option
    • Default
      none
    • As labeled in the HTML tool
      Brace Style
  • braces

    • Description
      Determines if opening curly braces will exist on the same line as their condition or be forced onto a new line.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Style of Indent
  • color

    • Description
      The color scheme of the reports.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Accepted Values
      canvas
      A light brown color scheme
      shadow
      A black and ashen color scheme
      white
      A white and pale grey color scheme
    • Default
      white
    • As labeled in the HTML tool
      Color
  • comment_line

    • Description
      If a blank new line should be forced above comments.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Force an Empty Line Above Comments
  • comments

    • Description
      This will determine whether comments should always start at position 0 of each line or if comments should be indented according to the code.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Indent Comments
  • complete_document

    • Description
      Allows a preference for generating a complete HTML document instead of only generating content.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Generate A Complete HTML File
  • compressed_css

    • Description
      If CSS should be beautified in a style where the properties and values are minifed for faster reading of selectors.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      style
    • Default
      false
    • As labeled in the HTML tool
      Compressed CSS
  • conditional

    • Description
      If true then conditional comments used by Internet Explorer are preserved at minification of markup.
    • Environment
      any
    • Type
      boolean
    • Mode
      minify
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      IE Comments (HTML Only)
  • content

    • Description
      This will normalize all string content to 'text' so as to eliminate some differences from the output.
    • Environment
      any
    • Type
      boolean
    • Mode
      diff
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Ignore Content
  • correct

    • Description
      Automatically correct some sloppiness in code.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Fix Sloppy Code
  • crlf

    • Description
      If line termination should be Windows (CRLF) format. Unix (LF) format is the default.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Line Termination
  • css_insert_lines

    • Description
      Inserts new line characters between every CSS code block.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      style
    • Default
      false
    • As labeled in the HTML tool
      Insert Empty Lines
  • diff

    • Description
      The code sample to be compared to 'source' option. This is required if mode is 'diff'.
    • Environment
      any
    • Type
      string
    • Mode
      diff
    • Lexer
      any
    • Default
    • As labeled in the HTML tool
      Code to Compare
  • diff_comments

    • Description
      If true then comments will be preserved so that both code and comments are compared by the diff engine.
    • Environment
      any
    • Type
      boolean
    • Mode
      diff
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Code Comments
  • diff_context

    • Description
      This shortens the diff output by allowing a specified number of equivalent lines between each line of difference. This option is only used with diff_format:html.
    • Environment
      any
    • Type
      number
    • Mode
      diff
    • Lexer
      any
    • Default
      -1
    • As labeled in the HTML tool
      Context Size
  • diff_format

    • Description
      The format of the output. The command line output format is text, similar to Unix 'diff'.
    • Environment
      any
    • Type
      string
    • Mode
      diff
    • Lexer
      any
    • Accepted Values
      html
      An HTML format for embedding in web pages, or as a complete web page if document_complete is true.
      json
      A JSON format.
      text
      Formatted similar to the Unix 'diff' command line utility.
    • Default
      text
    • As labeled in the HTML tool
      Diff Format
  • diff_label

    • Description
      This allows for a descriptive label for the diff file code of the diff HTML output.
    • Environment
      any
    • Type
      string
    • Mode
      diff
    • Lexer
      any
    • Default
      New Sample
    • As labeled in the HTML tool
      Label for Diff Sample
  • diff_rendered_html

    • Description
      Compares complete HTML documents and injects custom CSS so that the differences display not in the code, but in the rendered page in a browser. This option is currently confined only to markup languages, read_method file, and mode diff. Option diff_format is ignored.
    • Environment
      any
    • Type
      boolean
    • Mode
      diff
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Compare Rendered HTML
  • diff_space_ignore

    • Description
      If white space only differences should be ignored by the diff tool.
    • Environment
      any
    • Type
      boolean
    • Mode
      diff
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Remove White Space
  • diff_view

    • Description
      This determines whether the diff HTML output should display as a side-by-side comparison or if the differences should display in a single table column.
    • Environment
      any
    • Type
      string
    • Mode
      diff
    • Lexer
      any
    • Accepted Values
      inline
      A single column where insertions and deletions are vertically adjacent.
      sidebyside
      Two column comparison of changes.
    • Default
      sidebyside
    • As labeled in the HTML tool
      Diff View Type
  • else_line

    • Description
      If else_line is true then the keyword 'else' is forced onto a new line.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Else On New Line
  • end_comma

    • Description
      If there should be a trailing comma in arrays and objects. Value "multiline" only applies to modes beautify and diff.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      script
    • Accepted Values
      always
      Always ensure there is a tailing comma
      never
      Remove trailing commas
      none
      Ignore this option
    • Default
      never
    • As labeled in the HTML tool
      Trailing Comma
  • end_quietly

    • Description
      A node only option to determine if terminal summary data should be logged to the console.
    • Environment
      node
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Accepted Values
      default
      Default minimal summary
      log
      Verbose logging
      quiet
      No extraneous logging
    • Default
      default
    • As labeled in the HTML tool
      Log Summary to Console
  • force_attribute

    • Description
      If all markup attributes should be indented each onto their own line.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Force Indentation of All Attributes
  • force_indent

    • Description
      Will force indentation upon all content and tags without regard for the creation of new text nodes.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Force Indentation of All Content
  • format_array

    • Description
      Determines if all array indexes should be indented, never indented, or left to the default.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      script
    • Accepted Values
      default
      Default formatting
      indent
      Always indent each index of an array
      inline
      Ensure all array indexes appear on a single line
    • Default
      default
    • As labeled in the HTML tool
      Formatting Arrays
  • format_object

    • Description
      Determines if all object keys should be indented, never indented, or left to the default.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      script
    • Accepted Values
      default
      Default formatting
      indent
      Always indent each key/value pair
      inline
      Ensure all key/value pairs appear on the same single line
    • Default
      default
    • As labeled in the HTML tool
      Formatting Objects
  • function_name

    • Description
      If a space should follow a JavaScript function name.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Space After Function Name
  • help

    • Description
      A node only option to print documentation to the console. The value determines where to wrap text.
    • Environment
      node
    • Type
      number
    • Mode
      any
    • Lexer
      any
    • Default
      80
    • As labeled in the HTML tool
      Help Wrapping Limit
  • indent_char

    • Description
      The string characters to comprise a single indentation. Any string combination is accepted.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      any
    • Default
    • As labeled in the HTML tool
      Indentation Characters
  • indent_level

    • Description
      How much indentation padding should be applied to beautification? This option is internally used for code that requires switching between libraries.
    • Environment
      any
    • Type
      number
    • Mode
      beautify
    • Lexer
      any
    • Default
      0
    • As labeled in the HTML tool
      Indentation Padding
  • indent_size

    • Description
      The number of 'inchar' values to comprise a single indentation.
    • Environment
      any
    • Type
      number
    • Mode
      beautify
    • Lexer
      any
    • Default
      4
    • As labeled in the HTML tool
      Indent Size
  • jsscope

    • Description
      An educational tool to generate HTML output of JavaScript code to identify scope regions and declared references by color. This option is ignored unless the code language is JavaScript or TypeScript.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      script
    • Accepted Values
      html
      generates HTML output with escaped angle braces and ampersands for embedding as code, which is handy in code producing tools
      none
      prevents use of this option
      report
      generates HTML output that renders in web browsers
    • Default
      none
    • As labeled in the HTML tool
      JavaScript Scope Identification
  • language

    • Description
      The lowercase single word common name of the source code's programming language. The value 'auto' imposes language and lexer auto-detection, which ignores deliberately specified lexer values. The value 'text' is converted to 'auto' if options 'mode' is not 'diff'. Value 'text' allows literal comparisons.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Default
      auto
    • As labeled in the HTML tool
      Language
  • language_default

    • Description
      The fallback option if option 'lang' is set to 'auto' and a language cannot be detected.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Default
      text
    • As labeled in the HTML tool
      Language Auto-Detection Default
  • language_name

    • Description
      The formatted proper name of the code sample's language for use in reports read by people.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Default
      JavaScript
    • As labeled in the HTML tool
      Formatted Name of the Code's Language
  • lexer

    • Description
      This option determines which sets of rules to use in the language parser. If option 'language' has a value of 'auto', which is the default value, this option is ignored. The value 'text' is converted to 'auto' if options 'mode' is not 'diff'. Value 'text' allows literal comparisons.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Accepted Values
      auto
      The value 'auto' imposes language and lexer auto-detection, which ignores deliberately specified language values.
      markup
      parses languages like XML and HTML
      script
      parses languages with a C style syntax, such as JavaScript
      style
      parses CSS like languages
    • Default
      auto
    • As labeled in the HTML tool
      Parsing Lexer
  • list_options

    • Description
      A Node.js only option that writes current option settings to the console.
    • Environment
      node
    • Type
      boolean
    • Mode
      any
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Options List
  • method_chain

    • Description
      When to break consecutively chained methods and properties onto separate lines. A negative value disables this option. A value of 0 ensures method chains are never broken.
    • Environment
      any
    • Type
      number
    • Mode
      beautify
    • Lexer
      script
    • Default
      3
    • As labeled in the HTML tool
      Method Chains
  • minify_keep_comments

    • Description
      Prevents minification from stripping out comments.
    • Environment
      any
    • Type
      boolean
    • Mode
      minify
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Keep Comments
  • minify_wrap

    • Description
      Whether minified script should wrap after a specified character width. This option requires a value from option 'wrap'.
    • Environment
      any
    • Type
      boolean
    • Mode
      minify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Minification Wrapping
  • mode

    • Description
      The operation to be performed.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Accepted Values
      beautify
      beautifies code and returns a string
      diff
      returns either command line list of differences or an HTML report
      minify
      minifies code and returns a string
      parse
      using option 'parseFormat' returns an object with shallow arrays, a multidimensional array, or an HTML report
    • Default
      diff
    • As labeled in the HTML tool
      Mode
  • never_flatten

    • Description
      If destructured lists in script should never be flattend.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Never Flatten Destructured Lists
  • new_line

    • Description
      Insert an empty line at the end of output.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      New Line at End of Code
  • no_case_indent

    • Description
      If a case statement should receive the same indentation as the containing switch block.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Case Indentation
  • no_lead_zero

    • Description
      Whether leading 0s in CSS values immediately preceeding a decimal should be removed or prevented.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      style
    • Default
      false
    • As labeled in the HTML tool
      Leading 0s
  • node_error

    • Description
      A Node.js only option if parse errors should be written to the console.
    • Environment
      node
    • Type
      boolean
    • Mode
      any
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Write Parse Errors in Node
  • object_sort

    • Description
      Sorts markup attributes and properties by key name in script and style.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Object/Attribute Sort
  • output

    • Description
      A file path for which to write output. If this option is not specified output will be printed to the shell.
    • Environment
      node
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Default
    • As labeled in the HTML tool
      Output Location
  • parse_format

    • Description
      Determines the output format for 'parse' mode.
    • Environment
      any
    • Type
      string
    • Mode
      parse
    • Lexer
      any
    • Accepted Values
      htmltable
      generates the 'table' type output for the DOM but escapes the HTML tags for rendering as HTML code in a HTML tool
      parallel
      returns an object containing series of parallel arrays
      sequential
      returns an array where each index is a child object containing the parsed token and all descriptive data
      table
      generates a colorful grid of output for either the dom or command line interface
    • Default
      parallel
    • As labeled in the HTML tool
      Parse Format
  • parse_space

    • Description
      Whether whitespace tokens should be included in markup parse output.
    • Environment
      any
    • Type
      boolean
    • Mode
      parse
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Retain White Space Tokens in Parse Output
  • preserve

    • Description
      The maximum number of consecutive empty lines to retain.
    • Environment
      any
    • Type
      number
    • Mode
      beautify
    • Lexer
      any
    • Default
      0
    • As labeled in the HTML tool
      Preserve Consecutive New Lines
  • preserve_comment

    • Description
      Prevent comment reformatting due to option wrap.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Eliminate Word Wrap Upon Comments
  • preserve_text

    • Description
      If text in the provided markup code should be preserved exactly as provided. This option eliminates beautification and wrapping of text content.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Preserve Markup Text White Space
  • quote

    • Description
      If true and mode is 'diff' then all single quote characters will be replaced by double quote characters in both the source and diff file input so as to eliminate some differences from the diff report HTML output.
    • Environment
      any
    • Type
      boolean
    • Mode
      diff
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Normalize Quotes
  • quote_convert

    • Description
      If the quotes of script strings or markup attributes should be converted to single quotes or double quotes.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Accepted Values
      double
      Converts single quotes to double quotes
      none
      Ignores this option
      single
      Converts double quotes to single quotes
    • Default
      none
    • As labeled in the HTML tool
      Indent Size
  • read_method

    • Description
      The option determines how Node.js should receive input. All output will be printed to the shell unless the option 'output' is specified, which will write output to a file.
    • Environment
      node
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Accepted Values
      auto
      changes to value subdirectory, file, or screen depending on source resolution
      directory
      process all files in the specified directory only
      file
      reads a file and outputs to a file. file requires option 'output'
      screen
      reads from screen and outputs to screen
      subdirectory
      process all files in a directory and its subdirectories
    • Default
      auto
    • As labeled in the HTML tool
      Read Method
  • selector_list

    • Description
      If comma separated CSS selectors should present on a single line of code.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      style
    • Default
      false
    • As labeled in the HTML tool
      Indent Size
  • semicolon

    • Description
      If true and mode is 'diff' and lang is 'javascript' all semicolon characters that immediately preceed any white space containing a new line character will be removed so as to elimate some differences from the code comparison.
    • Environment
      any
    • Type
      boolean
    • Mode
      diff
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Indent Size
  • source

    • Description
      The source code or location for interpretation. This option is required for all modes.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      any
    • Default
    • As labeled in the HTML tool
      Source Sample
  • source_label

    • Description
      This allows for a descriptive label of the source file code for the diff HTML output.
    • Environment
      any
    • Type
      string
    • Mode
      diff
    • Lexer
      any
    • Default
      Source Sample
    • As labeled in the HTML tool
      Label for Source Sample
  • space

    • Description
      Inserts a space following the function keyword for anonymous functions.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      true
    • As labeled in the HTML tool
      Function Space
  • space_close

    • Description
      Markup self-closing tags end will end with ' />' instead of '/>'.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Close Markup Self-Closing Tags with a Space
  • styleguide

    • Description
      Provides a collection of option presets to easily conform to popular JavaScript style guides.
    • Environment
      any
    • Type
      string
    • Mode
      beautify
    • Lexer
      script
    • Accepted Values
      airbnb
      https://github.com/airbnb/javascript
      crockford
      http://jslint.com/
      google
      https://google.github.io/styleguide/jsguide.html
      jquery
      https://contribute.jquery.org/style-guide/js/
      jslint
      http://jslint.com/
      mediawiki
      https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript
      mrdoob
      https://github.com/mrdoob/three.js/wiki/Mr.doob's-Code-Style%E2%84%A2
      none
      Ignores this option
      standard
      https://standardjs.com/
      yandex
      https://github.com/ymaps/codestyle/blob/master/javascript.md
    • Default
      none
    • As labeled in the HTML tool
      Script Styleguide
  • summary_only

    • Description
      Node only option to output only number of differences.
    • Environment
      node
    • Type
      boolean
    • Mode
      diff
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Output Diff Only Without A Summary
  • tag_merge

    • Description
      Allows immediately adjacement start and end markup tags of the same name to be combined into a single self-closing tag.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Merge Adjacent Start and End tags
  • tag_sort

    • Description
      Sort child items of each respective markup parent element.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Sort Markup Child Items
  • ternary_line

    • Description
      If ternary operators in JavaScript ? and : should remain on the same line.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      script
    • Default
      false
    • As labeled in the HTML tool
      Keep Ternary Statements On One Line
  • top_comments

    • Description
      If mode is 'minify' this determines whether comments above the first line of code should be kept.
    • Environment
      any
    • Type
      boolean
    • Mode
      minify
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Retain Comment At Code Start
  • unformatted

    • Description
      If markup tags should have their insides preserved. This option is only available to markup and does not support child tokens that require a different lexer.
    • Environment
      any
    • Type
      boolean
    • Mode
      any
    • Lexer
      markup
    • Default
      false
    • As labeled in the HTML tool
      Markup Tag Preservation
  • variable_list

    • Description
      If consecutive JavaScript variables should be merged into a comma separated list or if variables in a list should be separated.
    • Environment
      any
    • Type
      string
    • Mode
      any
    • Lexer
      script
    • Accepted Values
      each
      Ensurce each reference is a single declaration statement.
      list
      Ensure consecutive declarations are a comma separated list.
      none
      Ignores this option.
    • Default
      none
    • As labeled in the HTML tool
      Variable Declaration Lists
  • version

    • Description
      A Node.js only option to write the version information to the console.
    • Environment
      node
    • Type
      boolean
    • Mode
      any
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Version
  • vertical

    • Description
      If lists of assignments and properties should be vertically aligned. This option is not used with the markup lexer.
    • Environment
      any
    • Type
      boolean
    • Mode
      beautify
    • Lexer
      any
    • Default
      false
    • As labeled in the HTML tool
      Vertical Alignment
  • wrap

    • Description
      Character width limit before applying word wrap. A 0 value disables this option. A negative value concatenates script strings.
    • Environment
      any
    • Type
      number
    • Mode
      any
    • Lexer
      any
    • Default
      0
    • As labeled in the HTML tool
      Wrap
  • @@ -373,6 +373,6 @@ - + \ No newline at end of file diff --git a/index.d.ts b/index.d.ts index 019d6945..ee0cd569 100644 --- a/index.d.ts +++ b/index.d.ts @@ -177,6 +177,7 @@ interface pd { options: any, saveAs?: Function; scopes: scriptScopes; + sparser: any; start: number; version: version; } diff --git a/index.xhtml b/index.xhtml index 2ba75d58..338c9fbf 100644 --- a/index.xhtml +++ b/index.xhtml @@ -9,7 +9,7 @@ - +
    -

    Latest Commit:2 Apr 2019 Version: 101.0.0 +

    Latest Commit:21 Apr 2019 Version: 101.0.0

    @@ -347,7 +347,7 @@ - + diff --git a/readme.md b/readme.md index c0d7e8e1..535b0e48 100644 --- a/readme.md +++ b/readme.md @@ -1,9 +1,7 @@ # Pretty Diff version 101 A language aware diff, beautification, and minification tool. -## Try it out -* Current version - https://prettydiff.com/ -* Prior version - https://prettydiff.com/2 +## Try it out - https://prettydiff.com/ [![Build Status](https://semaphoreci.com/api/v1/prettydiff/prettydiff/branches/master/badge.svg)](https://semaphoreci.com/prettydiff/prettydiff) diff --git a/services.ts b/services.ts index cc06ce36..43e01236 100644 --- a/services.ts +++ b/services.ts @@ -1016,7 +1016,8 @@ interface readFile { saveas:string = "", parser:string = "", defaults:string = "", - webtool:string = ""; + webtool:string = "", + complete:string = ""; const flag = { documentation: false, html: false, @@ -1172,6 +1173,29 @@ interface readFile { a = a + 1; } while (a < keyslen); return allItems.join(""); + }, + writeJavaScript = function node_apps_build_libraries_modifyFile_read_writeJavaScript():void { + if (flag.documentation === true && flag.html === true && flag.webtool === true) { + node.fs.writeFile(`${js}prettydiff.js`, `${complete}module.exports=prettydiff;return prettydiff;}());`, function node_apps_build_libraries_modifyFile_read_write_readParser_writeBrowser(erbr:Error) { + if (erbr !== null && erbr.toString() !== "") { + apps.errout([erbr.toString()]); + return; + } + node.fs.writeFile(`${js}browser.js`, `${complete}window.prettydiff=prettydiff;return prettydiff;}());`, function node_apps_build_libraries_modifyFile_read_write_readParser_writeBrowser_writePrettydiff(erth:Error) { + if (erth !== null && erth.toString() !== "") { + apps.errout([erth.toString()]); + return; + } + node.fs.writeFile(`${js}webtool.js`, webtool, function node_apps_build_libraries_modifyFile_read_write_readParser_writeBrowser_writePrettydiff_writeWebtool(erwb:Error) { + if (erwb !== null && erwb.toString() !== "") { + apps.errout([erwb.toString()]); + return; + } + next(`${text.green}Application files built and written.${text.none}`); + }); + }); + }); + } }; if (err !== null && err.toString() !== "") { apps.errout([err.toString()]); @@ -1200,36 +1224,23 @@ interface readFile { } else if (fileFlag === "webtool") { modify({ end: "// prettydiff dom insertion end", - injectFlag: saveas + libraries, + injectFlag: `prettydiff=${complete.replace(/(\s*\/\*(\w|\s|\d|\.|:|-)+\*\/)+\s*/, "").replace(/\s*("|')use\s+strict("|');/g, "") + saveas}return prettydiff;}());`, start: "// prettydiff dom insertion start" }); - webtool = `${parser + data.replace(/("|')use strict("|');/g, "").replace(/window\.sparser/g, "sparser")}}());`; + webtool = data; } - flag[fileFlag] = true; - if (flag.documentation === true && flag.html === true && flag.webtool === true) { - const inject = function node_apps_build_libraries_modifyFile_read_write_readParser_inject(version:string):string { - return `${version.slice(0, version.length - 1)},prettydiff=${mode}`; - }, - thirdparty:string = `${parser.replace(/version:\{date:"\d+\s+\w+\s+\d{4}",number:"\d+\.\d+\.\d+"\}\s*\};/, inject) + libraries}prettydiff.version=${JSON.stringify(prettydiff.version)};`; - node.fs.writeFile(`${js}prettydiff.js`, `${thirdparty}module.exports=prettydiff;return prettydiff;}());`, function node_apps_build_libraries_modifyFile_read_write_readParser_writeBrowser(erbr:Error) { - if (erbr !== null && erbr.toString() !== "") { - apps.errout([erbr.toString()]); + if (file.slice(file.length - 3) !== ".js") { + node.fs.writeFile(file, data, "utf8", function node_apps_build_libraries_modifyFile_write(err:Error) { + if (err !== null) { + apps.errout([err.toString()]); return; } - node.fs.writeFile(`${js}browser.js`, `${thirdparty}window.prettydiff=prettydiff;return prettydiff;}());`, function node_apps_build_libraries_modifyFile_read_write_readParser_writeBrowser_writePrettydiff(erth:Error) { - if (erth !== null && erth.toString() !== "") { - apps.errout([erth.toString()]); - return; - } - node.fs.writeFile(`${js}webtool.js`, webtool, function node_apps_build_libraries_modifyFile_read_write_readParser_writeBrowser_writePrettydiff_writeWebtool(erwb:Error) { - if (erwb !== null && erwb.toString() !== "") { - apps.errout([erwb.toString()]); - return; - } - next(`${text.green}Application files built and written.${text.none}`); - }); - }); + flag[fileFlag] = true; + writeJavaScript(); }); + } else { + flag[fileFlag] = true; + writeJavaScript(); } }); }, @@ -1283,6 +1294,10 @@ interface readFile { } a = a + 1; if (a === filelen) { + const inject = function node_apps_build_libraries_appendFile_inject(version:string):string { + return `${version.slice(0, version.length - 1)},prettydiff=${mode}`; + }; + complete = `${parser.replace(/version:\{date:"\d+\s+\w+\s+\d{4}",number:"\d+\.\d+\.\d+"\}\s*\};/, inject) + libraries}prettydiff.sparser=sparser;prettydiff.version=${JSON.stringify(prettydiff.version)};`; modifyFile(`${projectPath}index.xhtml`, "html"); modifyFile(`${js}api${sep}prettydiff-webtool.js`, "webtool"); modifyFile(`${projectPath}documentation.xhtml`, "documentation"); @@ -4249,11 +4264,9 @@ interface readFile { }; // unit test validation runner for Pretty Diff mode commands apps.validation = function node_apps_validation(callback:Function):void { - require(`${projectPath}node_modules${sep}sparser${sep}js${sep}parse`); let count_raw = 0, count_formatted = 0; - const all = require(`${projectPath}node_modules${sep}sparser${sep}js${sep}lexers${sep}all`), - flag = { + const flag = { raw: false, formatted: false }, @@ -4468,10 +4481,8 @@ interface readFile { if (command === "validation") { verbose = true; } - all(options, function node_apps_validation_allLexers() { - readDir("raw"); - readDir("formatted"); - }); + readDir("raw"); + readDir("formatted"); }; // runs apps.log apps.version = function ():void { diff --git a/tests/browser.html b/tests/browser.html index 62337222..9da17c0a 100644 --- a/tests/browser.html +++ b/tests/browser.html @@ -21,8 +21,8 @@

    Attaching the application

    Configuring and executing the application

    Configuring the application is as simple as creating the options object and passing that object into the application.

    let prettydiff = window.prettydiff; - window.prettydiff.options.source = "var a=1;"; - window.prettydiff.options.wrap = 80; + prettydiff.options.source = "var a=1;"; + prettydiff.options.wrap = 80; myResult = prettydiff();

    Please note that while that does work it is risky. I always recommend building options off the default options object for more predictable options. See the larger following example.

    From cd6cccc682e9f309681c4f372455eaf2b314d2ee Mon Sep 17 00:00:00 2001 From: austincheney Date: Sun, 21 Apr 2019 11:45:51 +0300 Subject: [PATCH 6/7] fixing CI tests --- api/mode.ts | 2 +- documentation.xhtml | 4 ++-- index.xhtml | 4 ++-- services.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/mode.ts b/api/mode.ts index a4918725..371cd055 100644 --- a/api/mode.ts +++ b/api/mode.ts @@ -1,4 +1,4 @@ -/*global global, prettydiff, window*/ +/*global prettydiff*/ function mode(diffmeta?:diffmeta):string { "use strict"; const pdcomment = function mode_pdcomment():void { diff --git a/documentation.xhtml b/documentation.xhtml index 1c7a620a..4f160f42 100644 --- a/documentation.xhtml +++ b/documentation.xhtml @@ -16,7 +16,7 @@ rel="meta" title="ICRA labels" type="application/rdf+xml"/> - + @@ -373,6 +373,6 @@ - + \ No newline at end of file diff --git a/index.xhtml b/index.xhtml index 338c9fbf..4e4c9568 100644 --- a/index.xhtml +++ b/index.xhtml @@ -9,7 +9,7 @@ - + - + diff --git a/services.ts b/services.ts index 43e01236..7e94cc83 100644 --- a/services.ts +++ b/services.ts @@ -1278,7 +1278,7 @@ interface readFile { .replace(/\s*("|')use strict("|');/, ""); if (filename === "mode.js" && filePath.indexOf(filename) === filePath.length - filename.length) { mode = filedata - .replace(/\/\*global\s+global\s*(\s*,\s*prettydiff)?(\s*,\s*window)?\*\//, "") + .replace(/\/\*\s*global\s+prettydiff\s*\*\//, "") .replace(/\s+/, "") .replace(/\s+$/, ";") .replace(/global(API)?\./g, "") From 1af171ee7c098ac0737e4637b58c796ff4aa4bed Mon Sep 17 00:00:00 2001 From: austincheney Date: Sun, 21 Apr 2019 11:56:35 +0300 Subject: [PATCH 7/7] a test update to fix compliance with appveyor --- tests/formatted/minify_style_less_top_comments.txt | 2 +- tests/raw/minify_style_less_top_comments.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/formatted/minify_style_less_top_comments.txt b/tests/formatted/minify_style_less_top_comments.txt index 66a6c672..a4110aec 100644 --- a/tests/formatted/minify_style_less_top_comments.txt +++ b/tests/formatted/minify_style_less_top_comments.txt @@ -8,4 +8,4 @@ Please see the license.txt file associated with the Pretty Diff application for license information. ****************************************************************************/ -@carrier-logo-height:33px;@carrier-logo-width:44px;.itemResultsCard(){@arrow-size:10px;@font-size-xxs:10px;@line-height-xxs:12px;.itemResultsCard{border:1px solid @color-neutral-md-light;color:@color-black;.clearfix();.itemSummary{float:left;width:70%;.display-inline-block();}}} +@carrier-logo-height:33px;@carrier-logo-width:44px;.itemResultsCard(){@arrow-size:10px;@font-size-xxs:10px;@line-height-xxs:12px;.itemResultsCard{border:1px solid @color-neutral-md-light;color:@color-black;.itemSummary{float:left;width:70%;.display-inline-block();}}} diff --git a/tests/raw/minify_style_less_top_comments.txt b/tests/raw/minify_style_less_top_comments.txt index f7c7c217..7c7b0c59 100644 --- a/tests/raw/minify_style_less_top_comments.txt +++ b/tests/raw/minify_style_less_top_comments.txt @@ -18,7 +18,6 @@ .itemResultsCard { border: 1px solid @color-neutral-md-light; - .clearfix(); color : @color-black; // Card Layout Sections