Commit 0ae470fd authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

Merge branch 'MLAB-670' into 'testing'

Update required modules

See merge request !162
parents cad730bf d27c335f
Pipeline #6650 passed with stage
in 4 seconds
import type { GenMapping } from '@jridgewell/gen-mapping';
import type { DecodedSourceMap, EncodedSourceMap, Options } from './types';
/**
* A SourceMap v3 compatible sourcemap, which only includes fields that were
* provided to it.
*/
export default class SourceMap {
file?: string | null;
mappings: EncodedSourceMap['mappings'] | DecodedSourceMap['mappings'];
sourceRoot?: string;
names: string[];
sources: (string | null)[];
sourcesContent?: (string | null)[];
version: 3;
constructor(map: GenMapping, options: Options);
toString(): string;
}
import type { SourceMapInput } from '@jridgewell/trace-mapping';
export type { SourceMapSegment, DecodedSourceMap, EncodedSourceMap, } from '@jridgewell/trace-mapping';
export type { SourceMapInput };
export declare type LoaderContext = {
readonly importer: string;
readonly depth: number;
source: string;
content: string | null | undefined;
};
export declare type SourceMapLoader = (file: string, ctx: LoaderContext) => SourceMapInput | null | undefined | void;
export declare type Options = {
excludeContent?: boolean;
decodedMappings?: boolean;
};
{
"name": "@ampproject/remapping",
"version": "2.2.0",
"description": "Remap sequential sourcemaps through transformations to point at the original source code",
"keywords": [
"source",
"map",
"remap"
],
"main": "dist/remapping.umd.js",
"module": "dist/remapping.mjs",
"typings": "dist/types/remapping.d.ts",
"files": [
"dist"
],
"author": "Justin Ridgewell <jridgewell@google.com>",
"repository": {
"type": "git",
"url": "git+https://github.com/ampproject/remapping.git"
},
"license": "Apache-2.0",
"engines": {
"node": ">=6.0.0"
},
"scripts": {
"build": "run-s -n build:*",
"build:rollup": "rollup -c rollup.config.js",
"build:ts": "tsc --project tsconfig.build.json",
"lint": "run-s -n lint:*",
"lint:prettier": "npm run test:lint:prettier -- --write",
"lint:ts": "npm run test:lint:ts -- --fix",
"prebuild": "rm -rf dist",
"prepublishOnly": "npm run preversion",
"preversion": "run-s test build",
"test": "run-s -n test:lint test:only",
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
"test:lint": "run-s -n test:lint:*",
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
"test:only": "jest --coverage",
"test:watch": "jest --coverage --watch"
},
"devDependencies": {
"@rollup/plugin-typescript": "8.3.2",
"@types/jest": "27.4.1",
"@typescript-eslint/eslint-plugin": "5.20.0",
"@typescript-eslint/parser": "5.20.0",
"eslint": "8.14.0",
"eslint-config-prettier": "8.5.0",
"jest": "27.5.1",
"jest-config": "27.5.1",
"npm-run-all": "4.1.5",
"prettier": "2.6.2",
"rollup": "2.70.2",
"ts-jest": "27.1.4",
"tslib": "2.4.0",
"typescript": "4.6.3"
},
"dependencies": {
"@jridgewell/gen-mapping": "^0.1.0",
"@jridgewell/trace-mapping": "^0.3.9"
}
}
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# @babel/cli
> Babel command line.
See our website [@babel/cli](https://babeljs.io/docs/en/babel-cli) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20cli%22+is%3Aopen) associated with this package.
## Install
Using npm:
```sh
npm install --save-dev @babel/cli
```
or using yarn:
```sh
yarn add @babel/cli --dev
```
#!/usr/bin/env node
require("../lib/babel-external-helpers");
#!/usr/bin/env node
require("../lib/babel");
throw new Error("Use the `@babel/core` package instead of `@babel/cli`.");
"use strict";
function _commander() {
const data = require("commander");
_commander = function () {
return data;
};
return data;
}
function _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
function collect(value, previousValue) {
if (typeof value !== "string") return previousValue;
const values = value.split(",");
if (previousValue) {
previousValue.push(...values);
return previousValue;
}
return values;
}
_commander().option("-l, --whitelist [whitelist]", "Whitelist of helpers to ONLY include", collect);
_commander().option("-t, --output-type [type]", "Type of output (global|umd|var)", "global");
_commander().usage("[options]");
_commander().parse(process.argv);
console.log((0, _core().buildExternalHelpers)(_commander().whitelist, _commander().outputType));
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _slash() {
const data = require("slash");
_slash = function () {
return data;
};
return data;
}
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
function _fs() {
const data = require("fs");
_fs = function () {
return data;
};
return data;
}
var util = require("./util");
var watcher = require("./watcher");
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
const FILE_TYPE = Object.freeze({
NON_COMPILABLE: "NON_COMPILABLE",
COMPILED: "COMPILED",
IGNORED: "IGNORED",
ERR_COMPILATION: "ERR_COMPILATION"
});
function outputFileSync(filePath, data) {
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(_path().dirname(filePath), {
recursive: true
});
_fs().writeFileSync(filePath, data);
}
function _default(_x) {
return _ref.apply(this, arguments);
}
function _ref() {
_ref = _asyncToGenerator(function* ({
cliOptions,
babelOptions
}) {
function write(_x2, _x3) {
return _write.apply(this, arguments);
}
function _write() {
_write = _asyncToGenerator(function* (src, base) {
let relative = _path().relative(base, src);
if (!util.isCompilableExtension(relative, cliOptions.extensions)) {
return FILE_TYPE.NON_COMPILABLE;
}
relative = util.withExtension(relative, cliOptions.keepFileExtension ? _path().extname(relative) : cliOptions.outFileExtension);
const dest = getDest(relative, base);
try {
const res = yield util.compile(src, Object.assign({}, babelOptions, {
sourceFileName: _slash()(_path().relative(dest + "/..", src))
}));
if (!res) return FILE_TYPE.IGNORED;
if (res.map && babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
const mapLoc = dest + ".map";
res.code = util.addSourceMappingUrl(res.code, mapLoc);
res.map.file = _path().basename(relative);
outputFileSync(mapLoc, JSON.stringify(res.map));
}
outputFileSync(dest, res.code);
util.chmod(src, dest);
if (cliOptions.verbose) {
console.log(_path().relative(process.cwd(), src) + " -> " + dest);
}
return FILE_TYPE.COMPILED;
} catch (err) {
if (cliOptions.watch) {
console.error(err);
return FILE_TYPE.ERR_COMPILATION;
}
throw err;
}
});
return _write.apply(this, arguments);
}
function getDest(filename, base) {
if (cliOptions.relative) {
return _path().join(base, cliOptions.outDir, filename);
}
return _path().join(cliOptions.outDir, filename);
}
function handleFile(_x4, _x5) {
return _handleFile.apply(this, arguments);
}
function _handleFile() {
_handleFile = _asyncToGenerator(function* (src, base) {
const written = yield write(src, base);
if (cliOptions.copyFiles && written === FILE_TYPE.NON_COMPILABLE || cliOptions.copyIgnored && written === FILE_TYPE.IGNORED) {
const filename = _path().relative(base, src);
const dest = getDest(filename, base);
outputFileSync(dest, _fs().readFileSync(src));
util.chmod(src, dest);
}
return written === FILE_TYPE.COMPILED;
});
return _handleFile.apply(this, arguments);
}
function handle(_x6) {
return _handle.apply(this, arguments);
}
function _handle() {
_handle = _asyncToGenerator(function* (filenameOrDir) {
if (!_fs().existsSync(filenameOrDir)) return 0;
const stat = _fs().statSync(filenameOrDir);
if (stat.isDirectory()) {
const dirname = filenameOrDir;
let count = 0;
const files = util.readdir(dirname, cliOptions.includeDotfiles);
for (const filename of files) {
const src = _path().join(dirname, filename);
const written = yield handleFile(src, dirname);
if (written) count += 1;
}
return count;
} else {
const filename = filenameOrDir;
const written = yield handleFile(filename, _path().dirname(filename));
return written ? 1 : 0;
}
});
return _handle.apply(this, arguments);
}
let compiledFiles = 0;
let startTime = null;
const logSuccess = util.debounce(function () {
if (startTime === null) {
return;
}
const diff = process.hrtime(startTime);
console.log(`Successfully compiled ${compiledFiles} ${compiledFiles !== 1 ? "files" : "file"} with Babel (${diff[0] * 1e3 + Math.round(diff[1] / 1e6)}ms).`);
compiledFiles = 0;
startTime = null;
}, 100);
if (cliOptions.watch) watcher.enable({
enableGlobbing: true
});
if (!cliOptions.skipInitialBuild) {
if (cliOptions.deleteDirOnStart) {
util.deleteDir(cliOptions.outDir);
}
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(cliOptions.outDir, {
recursive: true
});
startTime = process.hrtime();
for (const filename of cliOptions.filenames) {
compiledFiles += yield handle(filename);
}
if (!cliOptions.quiet) {
logSuccess();
logSuccess.flush();
}
}
if (cliOptions.watch) {
let processing = 0;
const {
filenames
} = cliOptions;
let getBase;
if (filenames.length === 1) {
const base = filenames[0];
const absoluteBase = _path().resolve(base);
getBase = filename => {
return filename === absoluteBase ? _path().dirname(base) : base;
};
} else {
const filenameToBaseMap = new Map(filenames.map(filename => {
const absoluteFilename = _path().resolve(filename);
return [absoluteFilename, _path().dirname(filename)];
}));
const absoluteFilenames = new Map(filenames.map(filename => {
const absoluteFilename = _path().resolve(filename);
return [absoluteFilename, filename];
}));
const {
sep
} = _path();
getBase = filename => {
const base = filenameToBaseMap.get(filename);
if (base !== undefined) {
return base;
}
for (const [absoluteFilenameOrDir, relative] of absoluteFilenames) {
if (filename.startsWith(absoluteFilenameOrDir + sep)) {
filenameToBaseMap.set(filename, relative);
return relative;
}
}
return "";
};
}
filenames.forEach(filenameOrDir => {
watcher.watch(filenameOrDir);
});
watcher.onFilesChange(_asyncToGenerator(function* (filenames) {
processing++;
if (startTime === null) startTime = process.hrtime();
try {
const written = yield Promise.all(filenames.map(filename => handleFile(filename, getBase(filename))));
compiledFiles += written.filter(Boolean).length;
} catch (err) {
console.error(err);
}
processing--;
if (processing === 0 && !cliOptions.quiet) logSuccess();
}));
}
});
return _ref.apply(this, arguments);
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _convertSourceMap() {
const data = require("convert-source-map");
_convertSourceMap = function () {
return data;
};
return data;
}
function _traceMapping() {
const data = require("@jridgewell/trace-mapping");
_traceMapping = function () {
return data;
};
return data;
}
function _slash() {
const data = require("slash");
_slash = function () {
return data;
};
return data;
}
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
function _fs() {
const data = require("fs");
_fs = function () {
return data;
};
return data;
}
var util = require("./util");
var watcher = require("./watcher");
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _default(_x) {
return _ref.apply(this, arguments);
}
function _ref() {
_ref = _asyncToGenerator(function* ({
cliOptions,
babelOptions
}) {
function buildResult(fileResults) {
const mapSections = [];
let code = "";
let offset = 0;
for (const result of fileResults) {
if (!result) continue;
mapSections.push({
offset: {
line: offset,
column: 0
},
map: result.map || emptyMap()
});
code += result.code + "\n";
offset += countNewlines(result.code) + 1;
}
const map = new (_traceMapping().AnyMap)({
version: 3,
file: cliOptions.sourceMapTarget || _path().basename(cliOptions.outFile || "") || "stdout",
sections: mapSections