Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

metro-core

Package Overview
Dependencies
Maintainers
2
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro-core - npm Package Compare versions

Comparing version 0.73.3 to 0.73.5

4

package.json
{
"name": "metro-core",
"version": "0.73.3",
"version": "0.73.5",
"description": "🚇 Metro's core package.",

@@ -16,5 +16,5 @@ "main": "src/index.js",

"lodash.throttle": "^4.1.1",
"metro-resolver": "0.73.3"
"metro-resolver": "0.73.5"
},
"license": "MIT"
}

@@ -11,2 +11,3 @@ /**

*/
"use strict";

@@ -23,14 +24,10 @@

}
const keys = Object.keys(value).sort();
const length = keys.length;
const object = {};
for (let i = 0; i < length; i++) {
object[keys[i]] = value[keys[i]];
}
return object;
}
module.exports = canonicalize;

@@ -11,8 +11,7 @@ /**

*/
"use strict";
const AmbiguousModuleResolutionError = require("./errors/AmbiguousModuleResolutionError");
const PackageResolutionError = require("./errors/PackageResolutionError");
module.exports = {

@@ -19,0 +18,0 @@ AmbiguousModuleResolutionError,

@@ -11,2 +11,3 @@ /**

*/
"use strict";

@@ -24,3 +25,2 @@

}
module.exports = AmbiguousModuleResolutionError;

@@ -11,6 +11,6 @@ /**

*/
"use strict";
const { formatFileCandidates } = require("metro-resolver");
class PackageResolutionError extends Error {

@@ -32,3 +32,2 @@ constructor(opts) {

}
module.exports = PackageResolutionError;

@@ -11,12 +11,9 @@ /**

*/
"use strict";
const AmbiguousModuleResolutionError = require("./errors/AmbiguousModuleResolutionError");
const PackageResolutionError = require("./errors/PackageResolutionError");
const Logger = require("./Logger");
const Terminal = require("./Terminal");
module.exports = {

@@ -23,0 +20,0 @@ AmbiguousModuleResolutionError,

@@ -11,17 +11,13 @@ /**

*/
"use strict";
const VERSION = require("../package.json").version;
const { EventEmitter } = require("events");
const os = require("os");
const log_session = `${os.hostname()}-${Date.now()}`;
const eventEmitter = new EventEmitter();
function on(event, handler) {
eventEmitter.on(event, handler);
}
function createEntry(data) {

@@ -34,5 +30,8 @@ const logEntry =

: data;
return { ...logEntry, log_session, metro_bundler_version: VERSION };
return {
...logEntry,
log_session,
metro_bundler_version: VERSION,
};
}
function createActionStartEntry(data) {

@@ -54,10 +53,7 @@ const logEntry =

}
function createActionEndEntry(logEntry) {
const { action_name, action_phase, start_timestamp } = logEntry;
if (action_phase !== "start" || !Array.isArray(start_timestamp)) {
throw new Error("Action has not started or has already ended");
}
const timeDelta = process.hrtime(start_timestamp);

@@ -70,4 +66,3 @@ const duration_ms = Math.round((timeDelta[0] * 1e9 + timeDelta[1]) / 1e6);

duration_ms,
/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses an
/* $FlowFixMe[incompatible-cast] (>=0.111.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.111 was deployed. To see the error, delete this

@@ -78,3 +73,2 @@ * comment and run Flow. */

}
function log(logEntry) {

@@ -84,3 +78,2 @@ eventEmitter.emit("log", logEntry);

}
module.exports = {

@@ -87,0 +80,0 @@ on,

@@ -11,12 +11,9 @@ /**

*/
"use strict";
const throttle = require("lodash.throttle");
const readline = require("readline");
const tty = require("tty");
const util = require("util");
/**

@@ -31,3 +28,2 @@ * Clear some text that was previously printed on an interactive stream,

let lineCount = (str.match(/\n/g) || []).length;
while (lineCount > 0) {

@@ -39,2 +35,3 @@ readline.moveCursor(stream, 0, -1);

}
/**

@@ -49,3 +46,2 @@ * Cut a string into an array of string of the specific maximum size. A newline

*/
function chunkString(str, size) {

@@ -56,6 +52,6 @@ const ANSI_COLOR = "\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?m";

}
/**
* Get the stream as a TTY if it effectively looks like a valid TTY.
*/
function getTTYStream(stream) {

@@ -69,5 +65,5 @@ if (

}
return null;
}
/**

@@ -101,8 +97,7 @@ * We don't just print things to the console, sometimes we also want to show

*/
class Terminal {
constructor(stream) {
this._logLines = [];
this._nextStatusStr = ""; // $FlowFixMe[method-unbinding] added when improving typing for this parameters
this._nextStatusStr = "";
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
this._scheduleUpdate = throttle(this._update, 33);

@@ -112,2 +107,3 @@ this._statusStr = "";

}
/**

@@ -119,23 +115,16 @@ * Clear and write the new status, logging in bulk in-between. Doing this in a

*/
_update() {
const { _statusStr, _stream } = this;
const ttyStream = getTTYStream(_stream);
if (_statusStr === this._nextStatusStr && this._logLines.length === 0) {
return;
}
if (ttyStream != null) {
clearStringBackwards(ttyStream, _statusStr);
}
this._logLines.forEach((line) => {
_stream.write(line);
_stream.write("\n");
});
this._logLines = [];
if (ttyStream != null) {

@@ -146,8 +135,7 @@ this._nextStatusStr = chunkString(

).join("\n");
_stream.write(this._nextStatusStr);
}
this._statusStr = this._nextStatusStr;
}
/**

@@ -160,11 +148,9 @@ * Shows some text that is meant to be overriden later. Return the previous

*/
status(format, ...args) {
const { _nextStatusStr } = this;
this._nextStatusStr = util.format(format, ...args);
this._scheduleUpdate();
return _nextStatusStr;
}
/**

@@ -175,8 +161,7 @@ * Similar to `console.log`, except it moves the status/progress text out of

*/
log(format, ...args) {
this._logLines.push(util.format(format, ...args));
this._scheduleUpdate();
}
/**

@@ -186,3 +171,2 @@ * Log the current status and start from scratch. This is useful if the last

*/
persistStatus() {

@@ -192,3 +176,2 @@ this.log(this._nextStatusStr);

}
flush() {

@@ -198,3 +181,2 @@ // Useful if you're going to start calling console.log/console.error directly

// update starts writing to stream after a delay.
/* $FlowFixMe(>=0.99.0 site=react_native_fb) This comment suppresses an

@@ -206,3 +188,2 @@ * error found when Flow v0.99 was deployed. To see the error, delete this

}
module.exports = Terminal;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc