V8 Coverage Report
Files covered Lines Remaining
. / jslint_wrapper_cjs.cjs
100.00 %
60 / 60

0 / 60
    1.      1// The Unlicense
    2.      1//
    3.      1// This is free and unencumbered software released into the public domain.
    4.      1//
    5.      1// Anyone is free to copy, modify, publish, use, compile, sell, or
    6.      1// distribute this software, either in source code form or as a compiled
    7.      1// binary, for any purpose, commercial or non-commercial, and by any
    8.      1// means.
    9.      1//
   10.      1// In jurisdictions that recognize copyright laws, the author or authors
   11.      1// of this software dedicate any and all copyright interest in the
   12.      1// software to the public domain. We make this dedication for the benefit
   13.      1// of the public at large and to the detriment of our heirs and
   14.      1// successors. We intend this dedication to be an overt act of
   15.      1// relinquishment in perpetuity of all present and future rights to this
   16.      1// software under copyright law.
   17.      1//
   18.      1// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   19.      1// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   20.      1// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   21.      1// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
   22.      1// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   23.      1// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
   24.      1// OTHER DEALINGS IN THE SOFTWARE.
   25.      1
   26.      1
   27.      1/*jslint beta, node*/
   28.      1/*property
   29.      1    href, pathToFileURL, readFileSync, replace, runInThisContext, stringify
   30.      1*/
   31.      1
   32.      1// PR-513 - Run jslint.mjs in THIS context, wrapped as a function, not in a new
   33.      1// one: a new context has no process or console, so <jslint_cli> linted nothing
   34.      1// and resolved 0. Its ' import(' calls go to <import_cjs>, the real one here;
   35.      1// the file url lets its cli self-detect.
   36.      1
   37.      1const fileJslint = __dirname + "/jslint.mjs";
   38.      1const jslintRun = require("vm").runInThisContext(
   39.      1    "(function (import_cjs, module) {\"use strict\";" +
   40.      1    require("fs")
   41.      1        .readFileSync(fileJslint, "utf8")
   42.      1        .replace(
   43.      1            "\nexport default Object.freeze(jslint_export);",
   44.      1            "\nmodule.exports = jslint_export;"
   45.      1        )
   46.      1        .replace(
   47.      1            "\njslint_import_meta_url = import.meta.url;",
   48.      1            (
   49.      1                "\njslint_import_meta_url = " +
   50.      1                JSON.stringify(require("url").pathToFileURL(fileJslint).href) +
   51.      1                ";"
   52.      1            )
   53.      1        )
   54.      1        .replace((/ import\(/g), " import_cjs(") +
   55.      1    "\n})"
   56.      1);
   57.      4jslintRun(function (specifier) {
   58.      4    return import(specifier);
   59.      4}, module);
   60.      1