repo stringlengths 5 106 | file_url stringlengths 78 301 | file_path stringlengths 4 211 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:56:49 2026-01-05 02:23:25 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/types-internal/src/PackageManager.js | packages/core/types-internal/src/PackageManager.js | // @flow
import type {FileCreateInvalidation, PackageJSON} from './index';
import type {SemverRange} from './SemverRange';
import type {DependencySpecifier} from './DependencySpecifier';
import type {FileSystem} from './FileSystem';
import type {FilePath} from './FilePath';
export type PackageManagerResolveResult = {... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/types-internal/src/DependencySpecifier.js | packages/core/types-internal/src/DependencySpecifier.js | // @flow strict-local
/** See Dependency */
export type DependencySpecifier = string;
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/types-internal/src/Cache.js | packages/core/types-internal/src/Cache.js | // @flow strict-local
import type {Readable} from 'stream';
export interface Cache {
ensure(): Promise<void>;
has(key: string): Promise<boolean>;
get<T>(key: string): Promise<?T>;
set(key: string, value: mixed): Promise<void>;
getStream(key: string): Readable;
setStream(key: string, stream: Readable): Pro... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/types-internal/src/SemverRange.js | packages/core/types-internal/src/SemverRange.js | // @flow strict-local
export type SemverRange = string;
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/types-internal/src/FilePath.js | packages/core/types-internal/src/FilePath.js | // @flow strict-local
export type FilePath = string;
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/types-internal/src/FileSystem.js | packages/core/types-internal/src/FileSystem.js | // @flow
import type {FilePath} from './FilePath';
import type {Readable, Writable} from 'stream';
import type {
Event,
Options as WatcherOptions,
AsyncSubscription,
} from '@parcel/watcher';
export type FileOptions = {mode?: number, ...};
export type ReaddirOptions =
| {withFileTypes?: false, ...}
| {withFi... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/types-internal/src/PackageName.js | packages/core/types-internal/src/PackageName.js | // @flow strict-local
export type PackageName = string;
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/types-internal/src/Glob.js | packages/core/types-internal/src/Glob.js | // @flow strict-local
export type Glob = string;
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/.eslintrc.js | packages/core/utils/.eslintrc.js | const RESTRICTED_CONFIG = [
'error',
{
paths: [
{
name: '@parcel/workers',
message:
'Do not import workers inside utils. Instead, create a separate package.',
},
],
},
];
module.exports = {
extends: '@parcel/eslint-config',
rules: {
'no-restricted-imports': R... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/prettifyTime.js | packages/core/utils/src/prettifyTime.js | // @flow strict-local
export default function prettifyTime(timeInMs: number): string {
return timeInMs < 1000 ? `${timeInMs}ms` : `${(timeInMs / 1000).toFixed(2)}s`;
}
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/getModuleParts.js | packages/core/utils/src/getModuleParts.js | // @flow strict-local
import path from 'path';
import {normalizeSeparators} from './path';
/**
* Returns the package name and the optional subpath
*/
export default function getModuleParts(_name: string): [string, ?string] {
let name = path.normalize(_name);
let splitOn = name.indexOf(path.sep);
if (name.char... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/sourcemap.js | packages/core/utils/src/sourcemap.js | // @flow
import type {SourceLocation} from '@parcel/types';
import type {FileSystem} from '@parcel/fs';
import SourceMap from '@parcel/source-map';
import path from 'path';
import {normalizeSeparators, isAbsolute} from './path';
export const SOURCEMAP_RE: RegExp =
/(?:\/\*|\/\/)\s*[@#]\s*sourceMappingURL\s*=\s*([^\s... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/debounce.js | packages/core/utils/src/debounce.js | // @flow strict-local
export default function debounce<TArgs: Array<mixed>>(
fn: (...args: TArgs) => mixed,
delay: number,
): (...args: TArgs) => void {
let timeout;
return function (...args: TArgs) {
if (timeout) {
clearTimeout(timeout);
}
timeout = setTimeout(() => {
timeout = null;... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/prettyDiagnostic.js | packages/core/utils/src/prettyDiagnostic.js | // @flow strict-local
import type {Diagnostic} from '@parcel/diagnostic';
import type {PluginOptions} from '@parcel/types';
import formatCodeFrame from '@parcel/codeframe';
import _mdAnsi from '@parcel/markdown-ansi';
import _chalk from 'chalk';
import path from 'path';
// $FlowFixMe
import _terminalLink from 'termina... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/openInBrowser.js | packages/core/utils/src/openInBrowser.js | // @flow
import open from 'open';
import {execSync} from 'child_process';
import logger from '@parcel/logger';
// Chrome app name is platform dependent. we should not hard code it.
// https://github.com/react-native-community/cli/blob/e2be8a905285d9b37512fc78c9755b9635ecf805/packages/cli/src/commands/server/launchDeb... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/ansi-html.js | packages/core/utils/src/ansi-html.js | // @flow strict-local
import ansiHTML from 'ansi-html-community';
import {escapeHTML} from './escape-html';
export function ansiHtml(ansi: string): string {
return ansiHTML(escapeHTML(ansi));
}
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/getCertificate.js | packages/core/utils/src/getCertificate.js | // @flow
import type {HTTPSOptions} from '@parcel/types';
import type {FileSystem} from '@parcel/fs';
export default async function getCertificate(
fs: FileSystem,
options: HTTPSOptions,
): Promise<{|cert: Buffer, key: Buffer|}> {
try {
let cert = await fs.readFile(options.cert);
let key = await fs.readF... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/index.js | packages/core/utils/src/index.js | // @flow strict-local
export type * from './config';
export type * from './Deferred';
export type * from './generateBuildMetrics';
export type * from './http-server';
export type * from './path';
export type * from './prettyDiagnostic';
export type * from './schema';
export {default as countLines} from './countLines';... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/escape-html.js | packages/core/utils/src/escape-html.js | // @flow
// Based on _.escape https://github.com/lodash/lodash/blob/master/escape.js
const reUnescapedHtml = /[&<>"']/g;
const reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
const htmlEscapes = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
};
export function escapeHTML(s: stri... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/replaceBundleReferences.js | packages/core/utils/src/replaceBundleReferences.js | // @flow strict-local
import type SourceMap from '@parcel/source-map';
import type {
Async,
Blob,
Bundle,
BundleGraph,
Dependency,
NamedBundle,
} from '@parcel/types';
import {Readable} from 'stream';
import nullthrows from 'nullthrows';
import invariant from 'assert';
import URL from 'url';
import {buffe... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/is-url.js | packages/core/utils/src/is-url.js | // @flow
import _isURL from 'is-url';
// Matches anchor (ie: #raptors)
const ANCHOR_REGEXP = /^#/;
// Matches scheme (ie: tel:, mailto:, data:, itms-apps:)
const SCHEME_REGEXP = /^[a-z][a-z0-9\-+.]*:/i;
export default function isURL(url: string): boolean {
return _isURL(url) || ANCHOR_REGEXP.test(url) || SCHEME_R... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/collection.js | packages/core/utils/src/collection.js | // @flow strict-local
export function unique<T>(array: Array<T>): Array<T> {
return [...new Set(array)];
}
export function objectSortedEntries(obj: {
+[string]: mixed,
...
}): Array<[string, mixed]> {
return Object.entries(obj).sort(([keyA], [keyB]) => keyA.localeCompare(keyB));
}
export function objectSorte... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/parseCSSImport.js | packages/core/utils/src/parseCSSImport.js | // @flow strict
export default function parseCSSImport(url: string): string {
if (!/^(~|\.\/|\/)/.test(url)) {
return './' + url;
} else if (!/^(~\/|\.\/|\/)/.test(url)) {
return url.substring(1);
} else {
return url;
}
}
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/shared-buffer.js | packages/core/utils/src/shared-buffer.js | // @flow
export let SharedBuffer: Class<ArrayBuffer> | Class<SharedArrayBuffer>;
// $FlowFixMe[prop-missing]
if (process.browser) {
SharedBuffer = ArrayBuffer;
// Safari has removed the constructor
if (typeof SharedArrayBuffer !== 'undefined') {
let channel = new MessageChannel();
try {
// Firefox... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/svgo.js | packages/core/utils/src/svgo.js | // @flow
import type {FileSystem} from '@parcel/fs';
import ThrowableDiagnostic, {
generateJSONCodeHighlights,
} from '@parcel/diagnostic';
import path from 'path';
export function detectSVGOVersion(
config: any,
): {|version: 3|} | {|version: 2, path: string|} {
if (!config) {
return {version: 3};
}
//... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/schema.js | packages/core/utils/src/schema.js | // @flow strict-local
import ThrowableDiagnostic, {
generateJSONCodeHighlights,
escapeMarkdown,
encodeJSONKeyComponent,
} from '@parcel/diagnostic';
import type {Mapping} from '@mischnic/json-sourcemap';
import nullthrows from 'nullthrows';
import * as levenshtein from 'fastest-levenshtein';
export type SchemaEn... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/config.js | packages/core/utils/src/config.js | // @flow
import type {ConfigResult, File, FilePath} from '@parcel/types';
import type {FileSystem} from '@parcel/fs';
import ThrowableDiagnostic from '@parcel/diagnostic';
import path from 'path';
import clone from 'clone';
import json5 from 'json5';
import {parse as toml} from '@iarna/toml';
import {LRUCache} from 'l... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/getRootDir.js | packages/core/utils/src/getRootDir.js | // @flow strict-local
import type {FilePath} from '@parcel/types';
import {isGlob} from './glob';
import path from 'path';
export default function getRootDir(files: Array<FilePath>): FilePath {
let cur = null;
for (let file of files) {
let parsed = path.parse(file);
parsed.dir = findGlobRoot(parsed.dir);... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/isDirectoryInside.js | packages/core/utils/src/isDirectoryInside.js | // @flow strict-local
import type {FilePath} from '@parcel/types';
import path from 'path';
export default function isDirectoryInside(
child: FilePath,
parent: FilePath,
): boolean {
const relative = path.relative(parent, child);
return !relative.startsWith('..') && !path.isAbsolute(relative);
}
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/DefaultMap.js | packages/core/utils/src/DefaultMap.js | // @flow strict-local
export class DefaultMap<K, V> extends Map<K, V> {
_getDefault: K => V;
constructor(getDefault: K => V, entries?: Iterable<[K, V]>) {
super(entries);
this._getDefault = getDefault;
}
get(key: K): V {
let ret;
if (this.has(key)) {
ret = super.get(key);
} else {
... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/PromiseQueue.js | packages/core/utils/src/PromiseQueue.js | // @flow strict-local
import {makeDeferredWithPromise, type Deferred} from './Deferred';
type PromiseQueueOpts = {|maxConcurrent: number|};
export default class PromiseQueue<T> {
_deferred: ?Deferred<Array<T>>;
_maxConcurrent: number;
_numRunning: number = 0;
_queue: Array<() => Promise<void>> = [];
_runPr... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/generateBuildMetrics.js | packages/core/utils/src/generateBuildMetrics.js | // @flow
import type {FilePath, PackagedBundle} from '@parcel/types';
import type {FileSystem} from '@parcel/fs';
import SourceMap from '@parcel/source-map';
import nullthrows from 'nullthrows';
import path from 'path';
import {loadSourceMapUrl} from './';
export type AssetStats = {|
filePath: string,
size: numbe... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/http-server.js | packages/core/utils/src/http-server.js | // @flow strict-local
import type {
Server as HTTPOnlyServer,
IncomingMessage as HTTPRequest,
ServerResponse as HTTPResponse,
} from 'http';
import type {
Server as HTTPSServer,
IncomingMessage as HTTPSRequest,
ServerResponse as HTTPSResponse,
} from 'https';
import type {Socket} from 'net';
import type {F... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/throttle.js | packages/core/utils/src/throttle.js | // @flow strict-local
export default function throttle<TArgs: Iterable<mixed>>(
fn: (...args: TArgs) => mixed,
delay: number,
): (...args: TArgs) => void {
let lastCalled: ?number;
return function throttled(...args: TArgs) {
if (lastCalled == null || lastCalled + delay <= Date.now()) {
fn.call(this,... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/hash.js | packages/core/utils/src/hash.js | // @flow strict-local
import type {Readable} from 'stream';
import type {FileSystem} from '@parcel/fs';
import {objectSortedEntriesDeep} from './collection';
import {hashString, Hash} from '@parcel/rust';
export function hashStream(stream: Readable): Promise<string> {
let hash = new Hash();
return new Promise((r... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/relativeUrl.js | packages/core/utils/src/relativeUrl.js | // @flow
import path from 'path';
import url from 'url';
export default function relativeUrl(from: string, to: string): string {
return url.format(url.parse(path.relative(from, to)));
}
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/glob.js | packages/core/utils/src/glob.js | // @flow
import type {FilePath, Glob} from '@parcel/types';
import type {FileSystem} from '@parcel/fs';
import _isGlob from 'is-glob';
import fastGlob, {type FastGlobOptions} from 'fast-glob';
import micromatch, {isMatch, makeRe, type Options} from 'micromatch';
import {normalizeSeparators} from './path';
export fun... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/TapStream.js | packages/core/utils/src/TapStream.js | // @flow strict-local
import {Transform} from 'stream';
/*
* "Taps" into the contents of a flowing stream, yielding chunks to the passed
* callback. Continues to pass data chunks down the stream.
*/
export default class TapStream extends Transform {
_tap: Buffer => mixed;
constructor(tap: Buffer => mixed, opti... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/Deferred.js | packages/core/utils/src/Deferred.js | // @flow strict-local
import invariant from 'assert';
export type Deferred<T> = {|
resolve(T): void,
reject(mixed): void,
|};
export function makeDeferredWithPromise<T>(): {|
deferred: Deferred<T>,
promise: Promise<T>,
|} {
let deferred: ?Deferred<T>;
let promise = new Promise<T>((resolve, reject) => {
... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/dependency-location.js | packages/core/utils/src/dependency-location.js | // @flow
export default function createDependencyLocation(
start: interface {
line: number,
column: number,
},
specifier: string,
lineOffset: number = 0,
columnOffset: number = 0,
// Imports are usually wrapped in quotes
importWrapperLength: number = 2,
): {|
end: {|column: number, line: number... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/urlJoin.js | packages/core/utils/src/urlJoin.js | // @flow strict-local
import URL from 'url';
import path from 'path';
/**
* Joins a path onto a URL, and normalizes Windows paths
* e.g. from \path\to\res.js to /path/to/res.js.
*/
export default function urlJoin(
publicURL: string,
assetPath: string,
leadingDotSlash: boolean = false,
): string {
const url... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/generateCertificate.js | packages/core/utils/src/generateCertificate.js | // @flow
import type {FileSystem} from '@parcel/fs';
import forge from 'node-forge';
import path from 'path';
import logger from '@parcel/logger';
export default async function generateCertificate(
fs: FileSystem,
cacheDir: string,
host: ?string,
): Promise<{|cert: Buffer, key: Buffer|}> {
let certDirectory = ... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/relativeBundlePath.js | packages/core/utils/src/relativeBundlePath.js | // @flow strict-local
import type {FilePath, NamedBundle} from '@parcel/types';
import path from 'path';
import {relativePath} from './path';
export function relativeBundlePath(
from: NamedBundle,
to: NamedBundle,
opts: {|leadingDotSlash: boolean|} = {leadingDotSlash: true},
): FilePath {
let fromPath = path... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/progress-message.js | packages/core/utils/src/progress-message.js | // @flow strict-local
import type {BuildProgressEvent} from '@parcel/types';
import path from 'path';
export function getProgressMessage(event: BuildProgressEvent): ?string {
switch (event.phase) {
case 'transforming':
return `Building ${path.basename(event.filePath)}...`;
case 'bundling':
retu... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/objectHash.js | packages/core/utils/src/objectHash.js | // @flow strict-local
import crypto from 'crypto';
// $FlowFixMe
type Hashable = Object;
export default function objectHash(object: Hashable): string {
let hash = crypto.createHash('md5');
for (let key of Object.keys(object).sort()) {
let val = object[key];
if (typeof val === 'object' && val) {
has... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/stream.js | packages/core/utils/src/stream.js | // @flow strict-local
import {Readable, PassThrough} from 'stream';
import type {Blob} from '@parcel/types';
export function measureStreamLength(stream: Readable): Promise<number> {
return new Promise((resolve, reject) => {
let length = 0;
stream.on('data', chunk => {
length += chunk;
});
stre... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/countLines.js | packages/core/utils/src/countLines.js | // @flow strict-local
export default function countLines(
string: string,
startIndex: number = 0,
): number {
let lines = 1;
for (let i = startIndex; i < string.length; i++) {
if (string.charAt(i) === '\n') {
lines++;
}
}
return lines;
}
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/getExisting.js | packages/core/utils/src/getExisting.js | // @flow strict-local
import fs from 'fs';
/**
* Creates an object that contains both source and minified (using the source as a fallback).
* e.g. builtins.min.js and builtins.js.
*/
export default function getExisting(
minifiedPath: string,
sourcePath: string,
): {|minified: string, source: string|} {
let s... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/import-map.js | packages/core/utils/src/import-map.js | // @flow
import type {BundleGraph, NamedBundle} from '@parcel/types';
import {normalizeSeparators} from './path';
let importMapCache = new WeakMap();
export function getImportMap(
bundleGraph: BundleGraph<NamedBundle>,
entryBundle: NamedBundle,
): {[string]: string} {
let cache = importMapCache.get(bundleGraph)... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/blob.js | packages/core/utils/src/blob.js | // @flow strict-local
import type {Blob} from '@parcel/types';
import {Buffer} from 'buffer';
import {bufferStream} from './';
import {Readable} from 'stream';
export function blobToBuffer(blob: Blob): Promise<Buffer> {
if (blob instanceof Readable) {
return bufferStream(blob);
} else if (blob instanceof Buf... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/bundle-url.js | packages/core/utils/src/bundle-url.js | // @flow strict-local
let bundleURL: ?string = null;
function getBundleURLCached(): string {
if (bundleURL == null) {
bundleURL = _getBundleURL();
}
return bundleURL;
}
function _getBundleURL(): string {
// Attempt to find the URL of the current script and use that as the base URL
try {
throw new E... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/alternatives.js | packages/core/utils/src/alternatives.js | // @flow
import path from 'path';
import type {FileSystem} from '@parcel/types';
import {fuzzySearch} from './schema';
import {relativePath} from './path';
import {resolveConfig} from './config';
export async function findAlternativeNodeModules(
fs: FileSystem,
moduleName: string,
dir: string,
): Promise<Array<s... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/src/path.js | packages/core/utils/src/path.js | // @flow strict-local
import type {FilePath} from '@parcel/types';
import path from 'path';
const ABSOLUTE_PATH_REGEX = /^([a-zA-Z]:){0,1}[\\/]+/;
const SEPARATOR_REGEX = /[\\]+/g;
export function isAbsolute(filepath: string): boolean {
return ABSOLUTE_PATH_REGEX.test(filepath);
}
export function normalizeSeparato... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/objectHash.test.js | packages/core/utils/test/objectHash.test.js | // @flow
import assert from 'assert';
import objectHash from '../src/objectHash';
describe('objectHash', () => {
it('calculates the same hash for two different but deep equal objects', () => {
const obj1 = {
foo: {foo: 'foo', baz: ['foo', 'baz', 'bar'], bar: 'bar'},
baz: 'baz',
bar: 'bar',
... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/prettifyTime.test.js | packages/core/utils/test/prettifyTime.test.js | // @flow
import assert from 'assert';
import prettifyTime from '../src/prettifyTime';
describe('prettifyTime', () => {
it('should format numbers less than 1000 as ms', () => {
assert.equal(prettifyTime(888), '888ms');
assert.equal(prettifyTime(50), '50ms');
assert.equal(prettifyTime(0), '0ms');
});
... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/config.test.js | packages/core/utils/test/config.test.js | // @flow strict-local
import assert from 'assert';
import {loadConfig} from '../src/config';
import {inputFS as fs} from '@parcel/test-utils';
import path from 'path';
describe('loadConfig', () => {
it('load config with json', async () => {
assert.deepEqual(
(
await loadConfig(
fs,
... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/DefaultMap.test.js | packages/core/utils/test/DefaultMap.test.js | // @flow strict-local
import assert from 'assert';
import {DefaultMap} from '../src/DefaultMap';
describe('DefaultMap', () => {
it('constructs with entries just like Map', () => {
let map = new DefaultMap(
k => k,
[
[1, 3],
[2, 27],
],
);
assert.equal(map.get(1), 3);
... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/PromiseQueue.test.js | packages/core/utils/test/PromiseQueue.test.js | // @flow
import assert from 'assert';
import PromiseQueue from '../src/PromiseQueue';
import sinon from 'sinon';
describe('PromiseQueue', () => {
it('run() should resolve when all async functions in queue have completed', async () => {
let queue = new PromiseQueue();
let someBooleanToBeChanged = false;
... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/collection.test.js | packages/core/utils/test/collection.test.js | // @flow
import assert from 'assert';
import {
objectSortedEntries,
objectSortedEntriesDeep,
setDifference,
} from '../src/collection';
describe('objectSortedEntries', () => {
it('returns a sorted list of key/value tuples', () => {
assert.deepEqual(
objectSortedEntries({foo: 'foo', baz: 'baz', bar: ... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/urlJoin.test.js | packages/core/utils/test/urlJoin.test.js | // @flow strict-local
import assert from 'assert';
import urlJoin from '../src/urlJoin';
describe('urlJoin', () => {
it('Should join two paths', () => {
let joinedUrl = urlJoin('/', './image.jpeg?test=test');
assert.equal(joinedUrl, '/image.jpeg?test=test');
});
it('Should join two paths with longer pu... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/sourcemap.test.js | packages/core/utils/test/sourcemap.test.js | import assert from 'assert';
import {
matchSourceMappingURL,
loadSourceMapUrl,
loadSourceMap,
} from '../src/sourcemap';
import {NodeFS} from '@parcel/fs';
import path from 'path';
const fs = new NodeFS();
describe('loadSourceMap', () => {
it('should not match sourceMappingURL when not at the end of the bundl... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/throttle.test.js | packages/core/utils/test/throttle.test.js | // @flow strict-local
import assert from 'assert';
import sinon from 'sinon';
import throttle from '../src/throttle';
describe('throttle', () => {
it("doesn't invoke a function more than once in a given interval", () => {
let spy = sinon.spy();
let throttled = throttle(spy, 100);
throttled(1);
thro... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/replaceBundleReferences.test.js | packages/core/utils/test/replaceBundleReferences.test.js | // @flow strict-local
import type {NamedBundle, Dependency} from '@parcel/types';
import assert from 'assert';
import {getURLReplacement} from '../src/replaceBundleReferences';
describe('replace bundle references', () => {
it('Query params and named pipeline, relative', () => {
// $FlowFixMe
let fromBundle... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/input/sourcemap/referenced-min.js | packages/core/utils/test/input/sourcemap/referenced-min.js | function hello(){var l="Hello",o="world";console.log(l+" "+o+"!")}hello();
//# sourceMappingURL=file://referenced-min.js.map
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/input/sourcemap/inline.js | packages/core/utils/test/input/sourcemap/inline.js | //@ sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlcyI6WyJmb28uanMiLCJiYXIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O1VBQ0c7Ozs7Ozs7Ozs7Ozs7O3NCQ0RIO3NCQUNBIn0=
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/input/sourcemap/source-root.js | packages/core/utils/test/input/sourcemap/source-root.js | function hello(){var l="Hello",o="world";console.log(l+" "+o+"!")}hello();
//# sourceMappingURL=source-root.js.map
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/input/sourcemap/no-sourcemap.js | packages/core/utils/test/input/sourcemap/no-sourcemap.js | if ((ref$ = options.map) === 'linked' || ref$ === 'debug') {
mapPath = path.basename(outputFilename) + ".map";
result.code += "\n//# sourceMappingURL=" + mapPath + "\n";
} else {
result.code += "\n//# sourceMappingURL=data:application/json;base64," + bufferFrom(result.map.toString()).toString('base64') + "\n";
}
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/utils/test/input/config/config.js | packages/core/utils/test/input/config/config.js | module.exports = {
hoge: 'fuga',
};
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/diagnostic/src/diagnostic.js | packages/core/diagnostic/src/diagnostic.js | // @flow strict-local
import invariant from 'assert';
import nullthrows from 'nullthrows';
import {parse, type Mapping} from '@mischnic/json-sourcemap';
/** These positions are 1-based (so <code>1</code> is the first line/column) */
export type DiagnosticHighlightLocation = {|
+line: number,
+column: number,
|};
... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/diagnostic/test/JSONCodeHighlights.test.js | packages/core/diagnostic/test/JSONCodeHighlights.test.js | // @flow strict-local
import assert from 'assert';
import {generateJSONCodeHighlights} from '../src/diagnostic';
describe('generateJSONCodeHighlights', () => {
it('returns an escaped string 01', () => {
let result = generateJSONCodeHighlights(
`{
"a": 1
}`,
[
{key: '/a', type: 'key', messa... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/diagnostic/test/markdown.test.js | packages/core/diagnostic/test/markdown.test.js | // @flow
import assert from 'assert';
import {escapeMarkdown, md} from '../src/diagnostic';
describe('escapeMarkdown', () => {
it('returns an escaped string 01', () => {
assert.strictEqual('\\*test\\*', escapeMarkdown('*test*'));
});
it('returns an escaped string 02', () => {
assert.strictEqual('\\_tes... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/codeframe/src/codeframe.js | packages/core/codeframe/src/codeframe.js | // @flow
import type {DiagnosticCodeHighlight} from '@parcel/diagnostic';
import chalk from 'chalk';
import emphasize from 'emphasize';
import stringWidth from 'string-width';
import sliceAnsi from 'slice-ansi';
type CodeFramePadding = {|
before: number,
after: number,
|};
type CodeFrameOptionsInput = $Shape<Cod... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/codeframe/test/codeframe.test.js | packages/core/codeframe/test/codeframe.test.js | import assert from 'assert';
import {readFileSync} from 'fs';
import {join as joinPath} from 'path';
import codeframe from '../src/codeframe';
const LINE_END = '\n';
describe('codeframe', () => {
it('should create a codeframe', () => {
let codeframeString = codeframe(
'hello world',
[
{
... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/codeframe/test/fixtures/a.js | packages/core/codeframe/test/fixtures/a.js | import test from 'test';
import component from './component';
/**
* This is a comment
*/
import Tooltip from '../tooltip';
import VisuallyHidden from '../visually-hidden';
/**
* This is another comment
*/
import {Label} from './label';
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/types/src/index.js | packages/core/types/src/index.js | // @flow strict-local
import type WorkerFarm from '@parcel/workers';
import type {InitialParcelOptionsInternal} from '@parcel/types-internal';
export type * from '@parcel/types-internal';
export type InitialParcelOptions = InitialParcelOptionsInternal<WorkerFarm>;
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/feature-flags/src/types.js | packages/core/feature-flags/src/types.js | // @flow strict
export type FeatureFlags = {|
// This feature flag mostly exists to test the feature flag system, and doesn't have any build/runtime effect
+exampleFeature: boolean,
/**
* Use node.js implementation of @parcel/watcher watchman backend
*/
+useWatchmanWatcher: boolean,
|};
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/feature-flags/src/index.js | packages/core/feature-flags/src/index.js | // @flow strict
import type {FeatureFlags as _FeatureFlags} from './types';
// We need to do these gymnastics as we don't want flow-to-ts to touch DEFAULT_FEATURE_FLAGS,
// but we want to export FeatureFlags for Flow
export type FeatureFlags = _FeatureFlags;
export const DEFAULT_FEATURE_FLAGS: FeatureFlags = {
exam... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/feature-flags/test/feature-flags.test.js | packages/core/feature-flags/test/feature-flags.test.js | // @flow strict
import assert from 'assert';
import {getFeatureFlag, DEFAULT_FEATURE_FLAGS, setFeatureFlags} from '../src';
describe('feature-flag test', () => {
beforeEach(() => {
setFeatureFlags(DEFAULT_FEATURE_FLAGS);
});
it('has defaults', () => {
assert.equal(
getFeatureFlag('exampleFeature')... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/src/index.js | packages/core/package-manager/src/index.js | // @flow
import type {PackageManagerResolveResult} from '@parcel/types';
export type {
PackageManager,
Invalidations,
PackageInstaller,
ModuleRequest,
} from '@parcel/types';
export * from './Npm';
export * from './Pnpm';
export * from './Yarn';
export * from './MockPackageInstaller';
export * from './NodePac... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/src/Npm.js | packages/core/package-manager/src/Npm.js | // @flow strict-local
import type {PackageInstaller, InstallerOptions} from '@parcel/types';
import path from 'path';
import spawn from 'cross-spawn';
import logger from '@parcel/logger';
import promiseFromProcess from './promiseFromProcess';
import {registerSerializableClass} from '@parcel/core';
import {npmSpecifie... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/src/promiseFromProcess.js | packages/core/package-manager/src/promiseFromProcess.js | // @flow strict-local
import type {ChildProcess} from 'child_process';
export default function promiseFromProcess(
childProcess: ChildProcess,
): Promise<void> {
return new Promise((resolve, reject) => {
childProcess.on('error', reject);
childProcess.on('close', code => {
if (code !== 0) {
r... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/src/installPackage.js | packages/core/package-manager/src/installPackage.js | // @flow
import type {FilePath, PackageJSON} from '@parcel/types';
import type {
ModuleRequest,
PackageManager,
PackageInstaller,
InstallOptions,
} from '@parcel/types';
import type {FileSystem} from '@parcel/fs';
import invariant from 'assert';
import path from 'path';
import nullthrows from 'nullthrows';
im... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/src/getCurrentPackageManager.js | packages/core/package-manager/src/getCurrentPackageManager.js | // @flow
export default function getCurrentPackageManager(
userAgent: ?string = process.env.npm_config_user_agent,
): ?{|name: string, version: string|} {
if (!userAgent) {
return undefined;
}
const pmSpec = userAgent.split(' ')[0];
const separatorPos = pmSpec.lastIndexOf('/');
const name = pmSpec.sub... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/src/JSONParseStream.js | packages/core/package-manager/src/JSONParseStream.js | // @flow strict-local
import type {JSONObject} from '@parcel/types';
import logger from '@parcel/logger';
import {Transform} from 'stream';
// Transforms chunks of json strings to parsed objects.
// Pair with split2 to parse stream of newline-delimited text.
export default class JSONParseStream extends Transform {
... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/src/MockPackageInstaller.js | packages/core/package-manager/src/MockPackageInstaller.js | // @flow
import type {
ModuleRequest,
PackageInstaller,
InstallerOptions,
} from '@parcel/types';
import type {FileSystem} from '@parcel/fs';
import type {FilePath} from '@parcel/types';
import path from 'path';
import {ncp} from '@parcel/fs';
import {registerSerializableClass} from '@parcel/core';
import pkg f... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/src/Pnpm.js | packages/core/package-manager/src/Pnpm.js | // @flow strict-local
import type {PackageInstaller, InstallerOptions} from '@parcel/types';
import path from 'path';
import fs from 'fs';
import commandExists from 'command-exists';
import spawn from 'cross-spawn';
import logger from '@parcel/logger';
import split from 'split2';
import JSONParseStream from './JSONPa... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/src/NodePackageManager.js | packages/core/package-manager/src/NodePackageManager.js | // @flow
import type {FilePath, DependencySpecifier, SemverRange} from '@parcel/types';
import type {FileSystem} from '@parcel/fs';
import type {
ModuleRequest,
PackageManager,
PackageInstaller,
InstallOptions,
Invalidations,
PackageManagerResolveResult,
} from '@parcel/types';
import {registerSerializable... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/src/validateModuleSpecifier.js | packages/core/package-manager/src/validateModuleSpecifier.js | // @flow
const MODULE_REGEX = /^((@[^/\s]+\/){0,1}([^/\s.~]+[^/\s]*)){1}(@[^/\s]+){0,1}/;
export default function validateModuleSpecifier(moduleName: string): string {
let matches = MODULE_REGEX.exec(moduleName);
if (matches) {
return matches[0];
}
return '';
}
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/src/Yarn.js | packages/core/package-manager/src/Yarn.js | // @flow strict-local
import type {PackageInstaller, InstallerOptions} from '@parcel/types';
import commandExists from 'command-exists';
import spawn from 'cross-spawn';
import logger from '@parcel/logger';
import split from 'split2';
import JSONParseStream from './JSONParseStream';
import promiseFromProcess from './... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/src/utils.js | packages/core/package-manager/src/utils.js | // @flow strict-local
import type {FilePath, ModuleRequest} from '@parcel/types';
import type {FileSystem} from '@parcel/fs';
import invariant from 'assert';
import ThrowableDiagnostic from '@parcel/diagnostic';
import {resolveConfig} from '@parcel/utils';
import {exec as _exec} from 'child_process';
import {promisif... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/test/getCurrentPackageManager.test.js | packages/core/package-manager/test/getCurrentPackageManager.test.js | // @flow
import assert from 'assert';
import getCurrentPackageManager from '../src/getCurrentPackageManager';
describe('getCurrentPackageManager', () => {
it('yarn', () => {
const npm_config_user_agent = 'yarn/1.22.21 npm/? node/v21.1.0 darwin x64';
const currentPackageManager = getCurrentPackageManager(
... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/test/NodePackageManager.test.js | packages/core/package-manager/test/NodePackageManager.test.js | // @flow strict-local
import {MemoryFS, NodeFS, OverlayFS} from '@parcel/fs';
import assert from 'assert';
import invariant from 'assert';
import path from 'path';
import sinon from 'sinon';
import ThrowableDiagnostic from '@parcel/diagnostic';
import {loadConfig} from '@parcel/utils';
import WorkerFarm from '@parcel/... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/test/validateModuleSpecifiers.test.js | packages/core/package-manager/test/validateModuleSpecifiers.test.js | // @flow
import assert from 'assert';
import validateModuleSpecifier from '../src/validateModuleSpecifier';
describe('Validate Module Specifiers', () => {
it('Validate Module Specifiers', () => {
let modules = [
'@parcel/transformer-posthtml/package.json',
'@some-org/package@v1.0.0',
'@org/som... | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/test/fixtures/has-foo/node_modules/index.js | packages/core/package-manager/test/fixtures/has-foo/node_modules/index.js | javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false | |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/test/fixtures/has-foo/node_modules/foo/index.js | packages/core/package-manager/test/fixtures/has-foo/node_modules/foo/index.js | module.exports = 'foobar';
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/test/fixtures/packages/a/index.js | packages/core/package-manager/test/fixtures/packages/a/index.js | module.exports = 'a';
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/test/fixtures/packages/foo-2.0/index.js | packages/core/package-manager/test/fixtures/packages/foo-2.0/index.js | module.exports = 'foo';
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/test/fixtures/packages/peers-2.0/index.js | packages/core/package-manager/test/fixtures/packages/peers-2.0/index.js | module.exports = 'foo';
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/package-manager/test/fixtures/packages/peers/index.js | packages/core/package-manager/test/fixtures/packages/peers/index.js | module.exports = 'foo';
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
parcel-bundler/parcel | https://github.com/parcel-bundler/parcel/blob/73f691d67d22482440babb2d1846b7da2160f7cc/packages/core/test-utils/src/mochaSetup.js | packages/core/test-utils/src/mochaSetup.js | process.on('unhandledRejection', reason => {
throw reason;
});
| javascript | MIT | 73f691d67d22482440babb2d1846b7da2160f7cc | 2026-01-04T14:58:42.192224Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.