From 90e6cb94e9c9a4d055a0983c9c7386daa48f61f9 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:45:03 +0800 Subject: [PATCH] TODO#139893 [ FAQ 常見問題 -我進行預約後,顧問會用甚麼方式聯繫我? ] 文案調整 --- PAMapp/node_modules/acorn/dist/bin.js | 69 ++++++++++++++++++++++++---------- 1 files changed, 48 insertions(+), 21 deletions(-) diff --git a/PAMapp/node_modules/acorn/dist/bin.js b/PAMapp/node_modules/acorn/dist/bin.js index faa461e..8e64500 100644 --- a/PAMapp/node_modules/acorn/dist/bin.js +++ b/PAMapp/node_modules/acorn/dist/bin.js @@ -4,22 +4,46 @@ var fs = require('fs'); var acorn = require('./acorn.js'); -var infile, forceFile, silent = false, compact = false, tokenize = false; +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n["default"] = e; + return Object.freeze(n); +} + +var acorn__namespace = /*#__PURE__*/_interopNamespace(acorn); + +var inputFilePaths = [], forceFileName = false, fileMode = false, silent = false, compact = false, tokenize = false; var options = {}; function help(status) { var print = (status === 0) ? console.log : console.error; print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]"); - print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]"); + print(" [--tokenize] [--locations] [--allow-hash-bang] [--allow-await-outside-function] [--compact] [--silent] [--module] [--help] [--] [<infile>...]"); process.exit(status); } for (var i = 2; i < process.argv.length; ++i) { var arg = process.argv[i]; - if ((arg === "-" || arg[0] !== "-") && !infile) { infile = arg; } - else if (arg === "--" && !infile && i + 2 === process.argv.length) { forceFile = infile = process.argv[++i]; } - else if (arg === "--locations") { options.locations = true; } + if (arg[0] !== "-" || arg === "-") { inputFilePaths.push(arg); } + else if (arg === "--") { + inputFilePaths.push.apply(inputFilePaths, process.argv.slice(i + 1)); + forceFileName = true; + break + } else if (arg === "--locations") { options.locations = true; } else if (arg === "--allow-hash-bang") { options.allowHashBang = true; } + else if (arg === "--allow-await-outside-function") { options.allowAwaitOutsideFunction = true; } else if (arg === "--silent") { silent = true; } else if (arg === "--compact") { compact = true; } else if (arg === "--help") { help(0); } @@ -34,31 +58,34 @@ } } -function run(code) { - var result; +function run(codeList) { + var result = [], fileIdx = 0; try { - if (!tokenize) { - result = acorn.parse(code, options); - } else { - result = []; - var tokenizer = acorn.tokenizer(code, options), token; - do { - token = tokenizer.getToken(); - result.push(token); - } while (token.type !== acorn.tokTypes.eof) - } + codeList.forEach(function (code, idx) { + fileIdx = idx; + if (!tokenize) { + result = acorn__namespace.parse(code, options); + options.program = result; + } else { + var tokenizer = acorn__namespace.tokenizer(code, options), token; + do { + token = tokenizer.getToken(); + result.push(token); + } while (token.type !== acorn__namespace.tokTypes.eof) + } + }); } catch (e) { - console.error(infile && infile !== "-" ? e.message.replace(/\(\d+:\d+\)$/, function (m) { return m.slice(0, 1) + infile + " " + m.slice(1); }) : e.message); + console.error(fileMode ? e.message.replace(/\(\d+:\d+\)$/, function (m) { return m.slice(0, 1) + inputFilePaths[fileIdx] + " " + m.slice(1); }) : e.message); process.exit(1); } if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); } } -if (forceFile || infile && infile !== "-") { - run(fs.readFileSync(infile, "utf8")); +if (fileMode = inputFilePaths.length && (forceFileName || !inputFilePaths.includes("-") || inputFilePaths.length !== 1)) { + run(inputFilePaths.map(function (path) { return fs.readFileSync(path, "utf8"); })); } else { var code = ""; process.stdin.resume(); process.stdin.on("data", function (chunk) { return code += chunk; }); - process.stdin.on("end", function () { return run(code); }); + process.stdin.on("end", function () { return run([code]); }); } -- Gitblit v1.8.0