@parcel/utils
Advanced tools
Comparing version 2.0.0-alpha.2.1 to 2.0.0-alpha.3
@@ -19,3 +19,3 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
@@ -22,0 +22,0 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
103
lib/index.js
@@ -17,4 +17,6 @@ "use strict"; | ||
prettyError: true, | ||
prettyDiagnostic: true, | ||
PromiseQueue: true, | ||
promisify: true, | ||
validateSchema: true, | ||
syncPromise: true, | ||
@@ -86,2 +88,8 @@ TapStream: true, | ||
}); | ||
Object.defineProperty(exports, "prettyDiagnostic", { | ||
enumerable: true, | ||
get: function () { | ||
return _prettyDiagnostic.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "PromiseQueue", { | ||
@@ -99,2 +107,8 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "validateSchema", { | ||
enumerable: true, | ||
get: function () { | ||
return _schema.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "syncPromise", { | ||
@@ -151,2 +165,4 @@ enumerable: true, | ||
var _prettyDiagnostic = _interopRequireDefault(require("./prettyDiagnostic")); | ||
var _PromiseQueue = _interopRequireDefault(require("./PromiseQueue")); | ||
@@ -156,2 +172,15 @@ | ||
var _schema = _interopRequireWildcard(require("./schema")); | ||
Object.keys(_schema).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _schema[key]; | ||
} | ||
}); | ||
}); | ||
var _syncPromise = _interopRequireDefault(require("./syncPromise")); | ||
@@ -167,2 +196,15 @@ | ||
var _blob = require("./blob"); | ||
Object.keys(_blob).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _blob[key]; | ||
} | ||
}); | ||
}); | ||
var _collection = require("./collection"); | ||
@@ -207,5 +249,5 @@ | ||
var _errorUtils = require("./errorUtils"); | ||
var _glob = require("./glob"); | ||
Object.keys(_errorUtils).forEach(function (key) { | ||
Object.keys(_glob).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
@@ -216,3 +258,3 @@ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
get: function () { | ||
return _errorUtils[key]; | ||
return _glob[key]; | ||
} | ||
@@ -222,5 +264,5 @@ }); | ||
var _glob = require("./glob"); | ||
var _md = require("./md5"); | ||
Object.keys(_glob).forEach(function (key) { | ||
Object.keys(_md).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
@@ -231,3 +273,3 @@ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
get: function () { | ||
return _glob[key]; | ||
return _md[key]; | ||
} | ||
@@ -237,5 +279,5 @@ }); | ||
var _md = require("./md5"); | ||
var _httpServer = require("./http-server"); | ||
Object.keys(_md).forEach(function (key) { | ||
Object.keys(_httpServer).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
@@ -246,3 +288,3 @@ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
get: function () { | ||
return _md[key]; | ||
return _httpServer[key]; | ||
} | ||
@@ -265,2 +307,15 @@ }); | ||
var _replaceBundleReferences = require("./replaceBundleReferences"); | ||
Object.keys(_replaceBundleReferences).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _replaceBundleReferences[key]; | ||
} | ||
}); | ||
}); | ||
var _serializer = require("./serializer"); | ||
@@ -318,2 +373,32 @@ | ||
var _ansiHtml = require("./ansi-html"); | ||
Object.keys(_ansiHtml).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _ansiHtml[key]; | ||
} | ||
}); | ||
}); | ||
var _escapeHtml = require("./escape-html"); | ||
Object.keys(_escapeHtml).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _escapeHtml[key]; | ||
} | ||
}); | ||
}); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -37,2 +37,6 @@ "use strict"; | ||
getNumWaiting() { | ||
return this._queue.length; | ||
} | ||
add(fn) { | ||
@@ -92,3 +96,3 @@ return new Promise((resolve, reject) => { | ||
async _runFn(fn) { | ||
this._numRunning++; // console.log('RUNNING', this._numRunning, this._maxConcurrent, this._queue.length) | ||
this._numRunning++; | ||
@@ -95,0 +99,0 @@ try { |
@@ -15,3 +15,3 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
@@ -18,0 +18,0 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
@@ -17,3 +17,3 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
@@ -20,0 +20,0 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
@@ -10,3 +10,3 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
@@ -13,0 +13,0 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
{ | ||
"name": "@parcel/utils", | ||
"version": "2.0.0-alpha.2.1", | ||
"version": "2.0.0-alpha.3", | ||
"description": "Blazing fast, zero configuration web application bundler", | ||
"main": "lib/index.js", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
@@ -11,11 +13,14 @@ "type": "git", | ||
}, | ||
"main": "lib/index.js", | ||
"source": "src/index.js", | ||
"engines": { | ||
"node": ">= 10.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@iarna/toml": "^2.2.0", | ||
"@parcel/logger": "^2.0.0-alpha.2.1", | ||
"@parcel/codeframe": "^2.0.0-alpha.3", | ||
"@parcel/diagnostic": "^2.0.0-alpha.3", | ||
"@parcel/logger": "^2.0.0-alpha.3", | ||
"@parcel/markdown-ansi": "^2.0.0-alpha.3", | ||
"ansi-html": "^0.0.7", | ||
"clone": "^2.1.1", | ||
@@ -26,2 +31,3 @@ "deasync": "^0.1.14", | ||
"is-url": "^1.2.2", | ||
"js-levenshtein": "^1.1.6", | ||
"json5": "^1.0.1", | ||
@@ -39,3 +45,3 @@ "micromatch": "^4.0.2", | ||
}, | ||
"gitHead": "2c01341d81c41a70cb33acb51fff621353b3e494" | ||
} | ||
"gitHead": "d4b611ac4495787fa31dac40dda15eedb6e31492" | ||
} |
@@ -11,8 +11,7 @@ // @flow strict-local | ||
time: number, | ||
largestAssets: Array<{ | ||
largestAssets: Array<{| | ||
filePath: string, | ||
size: number, | ||
time: number, | ||
... | ||
}>, | ||
time: number | ||
|}>, | ||
totalAssets: number | ||
@@ -19,0 +18,0 @@ |}> |
// @flow strict-local | ||
export type * from './errorUtils'; | ||
export type * from './generateBundleReport'; | ||
export type * from './prettyError'; | ||
export type * from './prettyDiagnostic'; | ||
@@ -17,5 +16,7 @@ export {default as countLines} from './countLines'; | ||
export {default as prettyError} from './prettyError'; | ||
export {default as prettyDiagnostic} from './prettyDiagnostic'; | ||
export {default as PromiseQueue} from './PromiseQueue'; | ||
// $FlowFixMe this is untyped | ||
export {default as promisify} from './promisify'; | ||
export {default as validateSchema} from './schema'; | ||
export {default as syncPromise} from './syncPromise'; | ||
@@ -27,9 +28,12 @@ export {default as TapStream} from './TapStream'; | ||
export * from './blob'; | ||
export * from './collection'; | ||
export * from './config'; | ||
export * from './Deferred'; | ||
export * from './errorUtils'; | ||
export * from './glob'; | ||
export * from './md5'; | ||
export * from './schema'; | ||
export * from './http-server'; | ||
export * from './path'; | ||
export * from './replaceBundleReferences'; | ||
export * from './serializer'; | ||
@@ -39,1 +43,3 @@ export * from './stream'; | ||
export * from './relativeBundlePath'; | ||
export * from './ansi-html'; | ||
export * from './escape-html'; |
@@ -8,7 +8,6 @@ // @flow strict-local | ||
highlightedCodeFrame?: string, | ||
loc?: { | ||
loc?: {| | ||
column: number, | ||
line: number, | ||
... | ||
}, | ||
line: number | ||
|}, | ||
... | ||
@@ -15,0 +14,0 @@ }); |
@@ -5,3 +5,3 @@ // @flow strict-local | ||
type PromiseQueueOpts = {maxConcurrent: number, ...}; | ||
type PromiseQueueOpts = {|maxConcurrent: number|}; | ||
@@ -25,2 +25,6 @@ export default class PromiseQueue<T> { | ||
getNumWaiting(): number { | ||
return this._queue.length; | ||
} | ||
add(fn: () => Promise<T>): Promise<T> { | ||
@@ -81,3 +85,2 @@ return new Promise((resolve, reject) => { | ||
this._numRunning++; | ||
// console.log('RUNNING', this._numRunning, this._maxConcurrent, this._queue.length) | ||
try { | ||
@@ -84,0 +87,0 @@ await fn(); |
@@ -23,2 +23,16 @@ // @flow strict-local | ||
): Promise<ResolveResult> { | ||
if (process.env.PARCEL_BUILD_ENV !== 'production') { | ||
// $FlowFixMe | ||
opts = opts || {}; | ||
// $FlowFixMe | ||
opts.packageFilter = pkg => { | ||
if (pkg.name.startsWith('@parcel/') && pkg.name !== '@parcel/watcher') { | ||
if (pkg.source) { | ||
pkg.main = pkg.source; | ||
} | ||
} | ||
return pkg; | ||
}; | ||
} | ||
let res = await resolveAsync(id, { | ||
@@ -69,2 +83,16 @@ ...opts, | ||
): ResolveResult { | ||
if (process.env.PARCEL_BUILD_ENV !== 'production') { | ||
// $FlowFixMe | ||
opts = opts || {}; | ||
// $FlowFixMe | ||
opts.packageFilter = pkg => { | ||
if (pkg.name.startsWith('@parcel/') && pkg.name !== '@parcel/watcher') { | ||
if (pkg.source) { | ||
pkg.main = pkg.source; | ||
} | ||
} | ||
return pkg; | ||
}; | ||
} | ||
// $FlowFixMe | ||
@@ -71,0 +99,0 @@ let res = _resolve.sync(id, { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
142421
92
4414
9
19
7
+ Addedansi-html@^0.0.7
+ Addedjs-levenshtein@^1.1.6
+ Added@parcel/codeframe@2.12.0(transitive)
+ Addedansi-html@0.0.7(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedjs-levenshtein@1.1.6(transitive)
+ Addedsupports-color@7.2.0(transitive)