new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var allSettled = require('../implementation');
|
||||
var runTests = require('./tests');
|
||||
|
||||
var bound = callBind(allSettled);
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
var rebindable = function allSettled(iterable) {
|
||||
// eslint-disable-next-line no-invalid-this
|
||||
return bound(typeof this === 'undefined' ? Promise : this, iterable);
|
||||
};
|
||||
|
||||
test('as a function', function (t) {
|
||||
t.test('bad Promise/this value', function (st) {
|
||||
// eslint-disable-next-line no-useless-call
|
||||
st['throws'](function () { allSettled.call(undefined, []); }, TypeError, 'undefined is not an object');
|
||||
|
||||
// eslint-disable-next-line no-useless-call
|
||||
st['throws'](function () { allSettled.call(null, []); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(rebindable, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 200
|
||||
|
||||
[*.js]
|
||||
block_comment_start = /*
|
||||
block_comment = *
|
||||
block_comment_end = */
|
||||
|
||||
[*.yml]
|
||||
indent_size = 1
|
||||
|
||||
[package.json]
|
||||
indent_style = tab
|
||||
|
||||
[lib/core.json]
|
||||
indent_style = tab
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[{*.json,Makefile}]
|
||||
max_line_length = off
|
||||
|
||||
[test/{dotdot,resolver,module_dir,multirepo,node_path,pathfilter,precedence}/**/*]
|
||||
indent_style = off
|
||||
indent_size = off
|
||||
max_line_length = off
|
||||
insert_final_newline = off
|
||||
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/is-number-object
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"startWith.js","sourceRoot":"","sources":["../../../../src/internal/operators/startWith.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAuDvC,MAAM,UAAU,SAAS;IAAO,gBAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,2BAAc;;IAC5C,IAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACvC,OAAO,OAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAIhC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACjG,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,3 @@
|
||||
const legacy = require('../dist/legacy-exports')
|
||||
module.exports = legacy.set
|
||||
legacy.warnFileDeprecation(__filename)
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0.00312,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.00624,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0.00312,"100":0,"101":0,"102":0.00312,"103":0.06864,"104":0.00312,"105":0.00624,"106":0.00936,"107":0.00624,"108":0.01872,"109":0.24024,"110":0.1248,"111":0.00312,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.00312,"39":0,"40":0,"41":0,"42":0.00312,"43":0.00312,"44":0.00624,"45":0.00312,"46":0.00624,"47":0,"48":0,"49":0.00312,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0.00312,"59":0,"60":0,"61":0,"62":0,"63":0.00312,"64":0,"65":0,"66":0,"67":0,"68":0.00312,"69":0.00312,"70":0,"71":0.00312,"72":0.00312,"73":0,"74":0.00312,"75":0,"76":0.00624,"77":0.05304,"78":0.00312,"79":0.02808,"80":0.00312,"81":0.00936,"83":0.00624,"84":0.00312,"85":0.00312,"86":0.00312,"87":0.01248,"88":0.00312,"89":0.00624,"90":0.00312,"91":0.00312,"92":0.00624,"93":0.00312,"94":0.00312,"95":0.02496,"96":0.00624,"97":0.00312,"98":0.00936,"99":0.00624,"100":0.07488,"101":0.00624,"102":0.0156,"103":0.02184,"104":0.01872,"105":0.02184,"106":0.01872,"107":0.0312,"108":0.24024,"109":4.32432,"110":2.5272,"111":0,"112":0.00312,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.00312,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0.00312,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.04992,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0.00312,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0.00312,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.0156,"94":0.11544,"95":0.08112,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0.00312,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0.00312,"79":0,"80":0,"81":0,"83":0,"84":0.00312,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00312,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0.00312,"106":0,"107":0.02496,"108":0.00936,"109":0.2652,"110":0.3588},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.00936,"15":0.00312,_:"0","3.1":0,"3.2":0,"5.1":0.0156,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0,"13.1":0.00624,"14.1":0.01248,"15.1":0.00312,"15.2-15.3":0.00312,"15.4":0.00312,"15.5":0.01872,"15.6":0.05304,"16.0":0.00936,"16.1":0.08736,"16.2":0.0468,"16.3":0.03432,"16.4":0},G:{"8":0,"3.2":0.00153,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0.07511,"8.1-8.4":0.0092,"9.0-9.2":0,"9.3":0.01839,"10.0-10.2":0,"10.3":0.01686,"11.0-11.2":0.0046,"11.3-11.4":0.00307,"12.0-12.1":0.0092,"12.2-12.5":0.23299,"13.0-13.1":0.00153,"13.2":0.00307,"13.3":0.01839,"13.4-13.7":0.05825,"14.0-14.4":0.14715,"14.5-14.8":0.34949,"15.0-15.1":0.07204,"15.2-15.3":0.14409,"15.4":0.15482,"15.5":0.37555,"15.6":1.04541,"16.0":2.46636,"16.1":3.06418,"16.2":3.67579,"16.3":2.33607,"16.4":0.01686},P:{"4":0.08099,"20":1.0022,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.08099,"8.2":0,"9.2":0.03037,"10.1":0.01012,"11.1-11.2":0.10123,"12.0":0.02025,"13.0":0.12148,"14.0":0.10123,"15.0":0.05062,"16.0":0.18222,"17.0":0.18222,"18.0":0.16197,"19.0":2.29797},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.11808},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0.00672,"9":0,"10":0.00336,"11":0.0336,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.0688},H:{"0":0.35824},L:{"0":69.65264},R:{_:"0"},M:{"0":0.08256},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,21 @@
|
||||
import Cell from './cell';
|
||||
import Base from './base';
|
||||
import { TCell } from './types';
|
||||
declare class Row extends Base {
|
||||
private _cells;
|
||||
constructor(cells?: Cell[]);
|
||||
cell(index: number): Cell;
|
||||
get cells(): Cell[];
|
||||
set cells(cells: Cell[]);
|
||||
toArray(): TCell[];
|
||||
/**
|
||||
* Creates a new Row from an array of Cell(s)
|
||||
* This method generates a new ID for the Row and all nested elements
|
||||
*
|
||||
* @param cells
|
||||
* @returns Row
|
||||
*/
|
||||
static fromCells(cells: Cell[]): Row;
|
||||
get length(): number;
|
||||
}
|
||||
export default Row;
|
||||
@@ -0,0 +1,34 @@
|
||||
import { combineLatestInit } from '../observable/combineLatest';
|
||||
import { ObservableInput, ObservableInputTuple, OperatorFunction } from '../types';
|
||||
import { operate } from '../util/lift';
|
||||
import { argsOrArgArray } from '../util/argsOrArgArray';
|
||||
import { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';
|
||||
import { pipe } from '../util/pipe';
|
||||
import { popResultSelector } from '../util/args';
|
||||
|
||||
/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */
|
||||
export function combineLatest<T, A extends readonly unknown[], R>(
|
||||
sources: [...ObservableInputTuple<A>],
|
||||
project: (...values: [T, ...A]) => R
|
||||
): OperatorFunction<T, R>;
|
||||
/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */
|
||||
export function combineLatest<T, A extends readonly unknown[], R>(sources: [...ObservableInputTuple<A>]): OperatorFunction<T, [T, ...A]>;
|
||||
|
||||
/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */
|
||||
export function combineLatest<T, A extends readonly unknown[], R>(
|
||||
...sourcesAndProject: [...ObservableInputTuple<A>, (...values: [T, ...A]) => R]
|
||||
): OperatorFunction<T, R>;
|
||||
/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */
|
||||
export function combineLatest<T, A extends readonly unknown[], R>(...sources: [...ObservableInputTuple<A>]): OperatorFunction<T, [T, ...A]>;
|
||||
|
||||
/**
|
||||
* @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8.
|
||||
*/
|
||||
export function combineLatest<T, R>(...args: (ObservableInput<any> | ((...values: any[]) => R))[]): OperatorFunction<T, unknown> {
|
||||
const resultSelector = popResultSelector(args);
|
||||
return resultSelector
|
||||
? pipe(combineLatest(...(args as Array<ObservableInput<any>>)), mapOneOrManyArgs(resultSelector))
|
||||
: operate((source, subscriber) => {
|
||||
combineLatestInit([source, ...argsOrArgArray(args)])(subscriber);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? Array.prototype.filter : require("./shim");
|
||||
@@ -0,0 +1,3 @@
|
||||
// Create a simple path alias to allow browserify to resolve
|
||||
// the runtime on a supported path.
|
||||
module.exports = require('./dist/cjs/handlebars.runtime')['default'];
|
||||
@@ -0,0 +1,276 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import got from 'got';
|
||||
import { globby } from 'globby';
|
||||
import { FormData, fileFromSync } from 'node-fetch';
|
||||
import allSettled from 'promise.allsettled';
|
||||
import _ from 'lodash';
|
||||
import Release from '../GitRelease.js';
|
||||
import { format, e } from '../../util.js';
|
||||
import prompts from './prompts.js';
|
||||
|
||||
const docs = 'https://git.io/release-it-gitlab';
|
||||
|
||||
const noop = Promise.resolve();
|
||||
|
||||
class GitLab extends Release {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
this.registerPrompts(prompts);
|
||||
this.assets = [];
|
||||
const { certificateAuthorityFile } = this.options;
|
||||
this.certificateAuthorityOption = certificateAuthorityFile
|
||||
? { https: { certificateAuthority: fs.readFileSync(certificateAuthorityFile) } }
|
||||
: {};
|
||||
}
|
||||
|
||||
get client() {
|
||||
if (this._client) return this._client;
|
||||
const { tokenHeader } = this.options;
|
||||
const { baseUrl } = this.getContext();
|
||||
this._client = got.extend({
|
||||
prefixUrl: baseUrl,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'user-agent': 'webpro/release-it',
|
||||
[tokenHeader]: this.token
|
||||
},
|
||||
...this.certificateAuthorityOption
|
||||
});
|
||||
return this._client;
|
||||
}
|
||||
|
||||
async init() {
|
||||
await super.init();
|
||||
|
||||
const { skipChecks, tokenRef, tokenHeader } = this.options;
|
||||
const { repo } = this.getContext();
|
||||
const hasJobToken = (tokenHeader || '').toLowerCase() === 'job-token';
|
||||
const origin = this.options.origin || `https://${repo.host}`;
|
||||
this.setContext({
|
||||
id: encodeURIComponent(repo.repository),
|
||||
origin,
|
||||
baseUrl: `${origin}/api/v4`
|
||||
});
|
||||
|
||||
if (skipChecks) return;
|
||||
|
||||
if (!this.token) {
|
||||
throw e(`Environment variable "${tokenRef}" is required for GitLab releases.`, docs);
|
||||
}
|
||||
|
||||
if (!hasJobToken) {
|
||||
if (!(await this.isAuthenticated())) {
|
||||
throw e(`Could not authenticate with GitLab using environment variable "${tokenRef}".`, docs);
|
||||
}
|
||||
if (!(await this.isCollaborator())) {
|
||||
const { user, repo } = this.getContext();
|
||||
throw e(`User ${user.username} is not a collaborator for ${repo.repository}.`, docs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async isAuthenticated() {
|
||||
if (this.config.isDryRun) return true;
|
||||
const endpoint = `user`;
|
||||
try {
|
||||
const { id, username } = await this.request(endpoint, { method: 'GET' });
|
||||
this.setContext({ user: { id, username } });
|
||||
return true;
|
||||
} catch (err) {
|
||||
this.debug(err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async isCollaborator() {
|
||||
if (this.config.isDryRun) return true;
|
||||
const { id, user } = this.getContext();
|
||||
const endpoint = `projects/${id}/members/all/${user.id}`;
|
||||
try {
|
||||
const { access_level } = await this.request(endpoint, { method: 'GET' });
|
||||
return access_level && access_level >= 30;
|
||||
} catch (err) {
|
||||
this.debug(err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async beforeRelease() {
|
||||
await super.beforeRelease();
|
||||
await this.checkReleaseMilestones();
|
||||
}
|
||||
|
||||
async checkReleaseMilestones() {
|
||||
if (this.options.skipChecks) return;
|
||||
|
||||
const releaseMilestones = this.getReleaseMilestones();
|
||||
if (releaseMilestones.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.log.exec(`gitlab releases#checkReleaseMilestones`);
|
||||
|
||||
const { id } = this.getContext();
|
||||
const endpoint = `projects/${id}/milestones`;
|
||||
const requests = releaseMilestones.map(milestone => {
|
||||
const options = {
|
||||
method: 'GET',
|
||||
searchParams: {
|
||||
title: milestone,
|
||||
include_parent_milestones: true
|
||||
}
|
||||
};
|
||||
return this.request(endpoint, options).then(response => {
|
||||
if (!Array.isArray(response)) {
|
||||
const { baseUrl } = this.getContext();
|
||||
throw new Error(
|
||||
`Unexpected response from ${baseUrl}/${endpoint}. Expected an array but got: ${JSON.stringify(response)}`
|
||||
);
|
||||
}
|
||||
if (response.length === 0) {
|
||||
const error = new Error(`Milestone '${milestone}' does not exist.`);
|
||||
this.log.warn(error.message);
|
||||
throw error;
|
||||
}
|
||||
this.log.verbose(`gitlab releases#checkReleaseMilestones: milestone '${milestone}' exists`);
|
||||
});
|
||||
});
|
||||
try {
|
||||
await allSettled(requests).then(results => {
|
||||
for (const result of results) {
|
||||
if (result.status === 'rejected') {
|
||||
throw e('Missing one or more milestones in GitLab. Creating a GitLab release will fail.', docs);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
this.debug(err);
|
||||
throw err;
|
||||
}
|
||||
this.log.verbose('gitlab releases#checkReleaseMilestones: done');
|
||||
}
|
||||
|
||||
getReleaseMilestones() {
|
||||
const { milestones } = this.options;
|
||||
return (milestones || []).map(milestone => format(milestone, this.config.getContext()));
|
||||
}
|
||||
|
||||
async release() {
|
||||
const glRelease = () => this.createRelease();
|
||||
const glUploadAssets = () => this.uploadAssets();
|
||||
|
||||
if (this.config.isCI) {
|
||||
await this.step({ enabled: this.options.assets, task: glUploadAssets, label: 'GitLab upload assets' });
|
||||
return await this.step({ task: glRelease, label: 'GitLab release' });
|
||||
} else {
|
||||
const release = () => glUploadAssets().then(() => glRelease());
|
||||
return await this.step({ task: release, label: 'GitLab release', prompt: 'release' });
|
||||
}
|
||||
}
|
||||
|
||||
async request(endpoint, options) {
|
||||
const { baseUrl } = this.getContext();
|
||||
this.debug(Object.assign({ url: `${baseUrl}/${endpoint}` }, options));
|
||||
const method = (options.method || 'POST').toLowerCase();
|
||||
const response = await this.client[method](endpoint, options);
|
||||
const body = typeof response.body === 'string' ? JSON.parse(response.body) : response.body || {};
|
||||
this.debug(body);
|
||||
return body;
|
||||
}
|
||||
|
||||
async createRelease() {
|
||||
const { releaseName } = this.options;
|
||||
const { tagName } = this.config.getContext();
|
||||
const { id, releaseNotes, repo, origin } = this.getContext();
|
||||
const { isDryRun } = this.config;
|
||||
const name = format(releaseName, this.config.getContext());
|
||||
const description = releaseNotes || '-';
|
||||
const releaseUrl = `${origin}/${repo.repository}/-/releases`;
|
||||
const releaseMilestones = this.getReleaseMilestones();
|
||||
|
||||
this.log.exec(`gitlab releases#createRelease "${name}" (${tagName})`, { isDryRun });
|
||||
|
||||
if (isDryRun) {
|
||||
this.setContext({ isReleased: true, releaseUrl });
|
||||
return true;
|
||||
}
|
||||
|
||||
const endpoint = `projects/${id}/releases`;
|
||||
const options = {
|
||||
json: {
|
||||
name,
|
||||
tag_name: tagName,
|
||||
description
|
||||
}
|
||||
};
|
||||
|
||||
if (this.assets.length) {
|
||||
options.json.assets = {
|
||||
links: this.assets
|
||||
};
|
||||
}
|
||||
|
||||
if (releaseMilestones.length) {
|
||||
options.json.milestones = releaseMilestones;
|
||||
}
|
||||
|
||||
try {
|
||||
await this.request(endpoint, options);
|
||||
this.log.verbose('gitlab releases#createRelease: done');
|
||||
this.setContext({ isReleased: true, releaseUrl });
|
||||
return true;
|
||||
} catch (err) {
|
||||
this.debug(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
async uploadAsset(filePath) {
|
||||
const name = path.basename(filePath);
|
||||
const { id, origin, repo } = this.getContext();
|
||||
const endpoint = `projects/${id}/uploads`;
|
||||
|
||||
const body = new FormData();
|
||||
body.set('file', fileFromSync(filePath));
|
||||
const options = { body };
|
||||
|
||||
try {
|
||||
const body = await this.request(endpoint, options);
|
||||
this.log.verbose(`gitlab releases#uploadAsset: done (${body.url})`);
|
||||
this.assets.push({
|
||||
name,
|
||||
url: `${origin}/${repo.repository}${body.url}`
|
||||
});
|
||||
} catch (err) {
|
||||
this.debug(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
uploadAssets() {
|
||||
const { assets } = this.options;
|
||||
const { isDryRun } = this.config;
|
||||
const context = this.config.getContext();
|
||||
|
||||
const patterns = _.castArray(assets).map(pattern => format(pattern, context));
|
||||
|
||||
this.log.exec('gitlab releases#uploadAssets', patterns, { isDryRun });
|
||||
|
||||
if (!assets) {
|
||||
return noop;
|
||||
}
|
||||
|
||||
return globby(patterns).then(files => {
|
||||
if (!files.length) {
|
||||
this.log.warn(`gitlab releases#uploadAssets: could not find "${assets}" relative to ${process.cwd()}`);
|
||||
}
|
||||
|
||||
if (isDryRun) return Promise.resolve();
|
||||
|
||||
return Promise.all(files.map(filePath => this.uploadAsset(filePath)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default GitLab;
|
||||
@@ -0,0 +1,127 @@
|
||||
# normalize-path [](https://www.npmjs.com/package/normalize-path) [](https://npmjs.org/package/normalize-path) [](https://npmjs.org/package/normalize-path) [](https://travis-ci.org/jonschlinkert/normalize-path)
|
||||
|
||||
> Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save normalize-path
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const normalize = require('normalize-path');
|
||||
|
||||
console.log(normalize('\\foo\\bar\\baz\\'));
|
||||
//=> '/foo/bar/baz'
|
||||
```
|
||||
|
||||
**win32 namespaces**
|
||||
|
||||
```js
|
||||
console.log(normalize('\\\\?\\UNC\\Server01\\user\\docs\\Letter.txt'));
|
||||
//=> '//?/UNC/Server01/user/docs/Letter.txt'
|
||||
|
||||
console.log(normalize('\\\\.\\CdRomX'));
|
||||
//=> '//./CdRomX'
|
||||
```
|
||||
|
||||
**Consecutive slashes**
|
||||
|
||||
Condenses multiple consecutive forward slashes (except for leading slashes in win32 namespaces) to a single slash.
|
||||
|
||||
```js
|
||||
console.log(normalize('.//foo//bar///////baz/'));
|
||||
//=> './foo/bar/baz'
|
||||
```
|
||||
|
||||
### Trailing slashes
|
||||
|
||||
By default trailing slashes are removed. Pass `false` as the last argument to disable this behavior and _**keep** trailing slashes_:
|
||||
|
||||
```js
|
||||
console.log(normalize('foo\\bar\\baz\\', false)); //=> 'foo/bar/baz/'
|
||||
console.log(normalize('./foo/bar/baz/', false)); //=> './foo/bar/baz/'
|
||||
```
|
||||
|
||||
## Release history
|
||||
|
||||
### v3.0
|
||||
|
||||
No breaking changes in this release.
|
||||
|
||||
* a check was added to ensure that [win32 namespaces](https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces) are handled properly by win32 `path.parse()` after a path has been normalized by this library.
|
||||
* a minor optimization was made to simplify how the trailing separator was handled
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Related projects
|
||||
|
||||
Other useful path-related libraries:
|
||||
|
||||
* [contains-path](https://www.npmjs.com/package/contains-path): Return true if a file path contains the given path. | [homepage](https://github.com/jonschlinkert/contains-path "Return true if a file path contains the given path.")
|
||||
* [is-absolute](https://www.npmjs.com/package/is-absolute): Returns true if a file path is absolute. Does not rely on the path module… [more](https://github.com/jonschlinkert/is-absolute) | [homepage](https://github.com/jonschlinkert/is-absolute "Returns true if a file path is absolute. Does not rely on the path module and can be used as a polyfill for node.js native `path.isAbolute`.")
|
||||
* [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative "Returns `true` if the path appears to be relative.")
|
||||
* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Pollyfill for node.js `path.parse`, parses a filepath into an object. | [homepage](https://github.com/jonschlinkert/parse-filepath "Pollyfill for node.js `path.parse`, parses a filepath into an object.")
|
||||
* [path-ends-with](https://www.npmjs.com/package/path-ends-with): Return `true` if a file path ends with the given string/suffix. | [homepage](https://github.com/jonschlinkert/path-ends-with "Return `true` if a file path ends with the given string/suffix.")
|
||||
* [unixify](https://www.npmjs.com/package/unixify): Convert Windows file paths to unix paths. | [homepage](https://github.com/jonschlinkert/unixify "Convert Windows file paths to unix paths.")
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 35 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 1 | [phated](https://github.com/phated) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on April 19, 2018._
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
if (!require("./is-implemented")()) {
|
||||
Object.defineProperty(Number, "EPSILON", {
|
||||
value: require("./"),
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
const { isArray } = Array;
|
||||
const { getPrototypeOf, prototype: objectProto, keys: getKeys } = Object;
|
||||
|
||||
/**
|
||||
* Used in functions where either a list of arguments, a single array of arguments, or a
|
||||
* dictionary of arguments can be returned. Returns an object with an `args` property with
|
||||
* the arguments in an array, if it is a dictionary, it will also return the `keys` in another
|
||||
* property.
|
||||
*/
|
||||
export function argsArgArrayOrObject<T, O extends Record<string, T>>(args: T[] | [O] | [T[]]): { args: T[]; keys: string[] | null } {
|
||||
if (args.length === 1) {
|
||||
const first = args[0];
|
||||
if (isArray(first)) {
|
||||
return { args: first, keys: null };
|
||||
}
|
||||
if (isPOJO(first)) {
|
||||
const keys = getKeys(first);
|
||||
return {
|
||||
args: keys.map((key) => first[key]),
|
||||
keys,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return { args: args as T[], keys: null };
|
||||
}
|
||||
|
||||
function isPOJO(obj: any): obj is object {
|
||||
return obj && typeof obj === 'object' && getPrototypeOf(obj) === objectProto;
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
import log, { dim } from './log'
|
||||
|
||||
export function normalizeConfig(config) {
|
||||
// Quick structure validation
|
||||
/**
|
||||
* type FilePath = string
|
||||
* type RawFile = { raw: string, extension?: string }
|
||||
* type ExtractorFn = (content: string) => Array<string>
|
||||
* type TransformerFn = (content: string) => string
|
||||
*
|
||||
* type Content =
|
||||
* | Array<FilePath | RawFile>
|
||||
* | {
|
||||
* files: Array<FilePath | RawFile>,
|
||||
* extract?: ExtractorFn | { [extension: string]: ExtractorFn }
|
||||
* transform?: TransformerFn | { [extension: string]: TransformerFn }
|
||||
* }
|
||||
*/
|
||||
let valid = (() => {
|
||||
// `config.purge` should not exist anymore
|
||||
if (config.purge) {
|
||||
return false
|
||||
}
|
||||
|
||||
// `config.content` should exist
|
||||
if (!config.content) {
|
||||
return false
|
||||
}
|
||||
|
||||
// `config.content` should be an object or an array
|
||||
if (
|
||||
!Array.isArray(config.content) &&
|
||||
!(typeof config.content === 'object' && config.content !== null)
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
// When `config.content` is an array, it should consist of FilePaths or RawFiles
|
||||
if (Array.isArray(config.content)) {
|
||||
return config.content.every((path) => {
|
||||
// `path` can be a string
|
||||
if (typeof path === 'string') return true
|
||||
|
||||
// `path` can be an object { raw: string, extension?: string }
|
||||
// `raw` must be a string
|
||||
if (typeof path?.raw !== 'string') return false
|
||||
|
||||
// `extension` (if provided) should also be a string
|
||||
if (path?.extension && typeof path?.extension !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
// When `config.content` is an object
|
||||
if (typeof config.content === 'object' && config.content !== null) {
|
||||
// Only `files`, `relative`, `extract`, and `transform` can exist in `config.content`
|
||||
if (
|
||||
Object.keys(config.content).some(
|
||||
(key) => !['files', 'relative', 'extract', 'transform'].includes(key)
|
||||
)
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
// `config.content.files` should exist of FilePaths or RawFiles
|
||||
if (Array.isArray(config.content.files)) {
|
||||
if (
|
||||
!config.content.files.every((path) => {
|
||||
// `path` can be a string
|
||||
if (typeof path === 'string') return true
|
||||
|
||||
// `path` can be an object { raw: string, extension?: string }
|
||||
// `raw` must be a string
|
||||
if (typeof path?.raw !== 'string') return false
|
||||
|
||||
// `extension` (if provided) should also be a string
|
||||
if (path?.extension && typeof path?.extension !== 'string') {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
// `config.content.extract` is optional, and can be a Function or a Record<String, Function>
|
||||
if (typeof config.content.extract === 'object') {
|
||||
for (let value of Object.values(config.content.extract)) {
|
||||
if (typeof value !== 'function') {
|
||||
return false
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
!(config.content.extract === undefined || typeof config.content.extract === 'function')
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
// `config.content.transform` is optional, and can be a Function or a Record<String, Function>
|
||||
if (typeof config.content.transform === 'object') {
|
||||
for (let value of Object.values(config.content.transform)) {
|
||||
if (typeof value !== 'function') {
|
||||
return false
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
!(
|
||||
config.content.transform === undefined || typeof config.content.transform === 'function'
|
||||
)
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
// `config.content.relative` is optional and can be a boolean
|
||||
if (
|
||||
typeof config.content.relative !== 'boolean' &&
|
||||
typeof config.content.relative !== 'undefined'
|
||||
) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
})()
|
||||
|
||||
if (!valid) {
|
||||
log.warn('purge-deprecation', [
|
||||
'The `purge`/`content` options have changed in Tailwind CSS v3.0.',
|
||||
'Update your configuration file to eliminate this warning.',
|
||||
'https://tailwindcss.com/docs/upgrade-guide#configure-content-sources',
|
||||
])
|
||||
}
|
||||
|
||||
// Normalize the `safelist`
|
||||
config.safelist = (() => {
|
||||
let { content, purge, safelist } = config
|
||||
|
||||
if (Array.isArray(safelist)) return safelist
|
||||
if (Array.isArray(content?.safelist)) return content.safelist
|
||||
if (Array.isArray(purge?.safelist)) return purge.safelist
|
||||
if (Array.isArray(purge?.options?.safelist)) return purge.options.safelist
|
||||
|
||||
return []
|
||||
})()
|
||||
|
||||
// Normalize the `blocklist`
|
||||
config.blocklist = (() => {
|
||||
let { blocklist } = config
|
||||
|
||||
if (Array.isArray(blocklist)) {
|
||||
if (blocklist.every((item) => typeof item === 'string')) {
|
||||
return blocklist
|
||||
}
|
||||
|
||||
log.warn('blocklist-invalid', [
|
||||
'The `blocklist` option must be an array of strings.',
|
||||
'https://tailwindcss.com/docs/content-configuration#discarding-classes',
|
||||
])
|
||||
}
|
||||
|
||||
return []
|
||||
})()
|
||||
|
||||
// Normalize prefix option
|
||||
if (typeof config.prefix === 'function') {
|
||||
log.warn('prefix-function', [
|
||||
'As of Tailwind CSS v3.0, `prefix` cannot be a function.',
|
||||
'Update `prefix` in your configuration to be a string to eliminate this warning.',
|
||||
'https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function',
|
||||
])
|
||||
config.prefix = ''
|
||||
} else {
|
||||
config.prefix = config.prefix ?? ''
|
||||
}
|
||||
|
||||
// Normalize the `content`
|
||||
config.content = {
|
||||
relative: (() => {
|
||||
let { content } = config
|
||||
|
||||
if (content?.relative) {
|
||||
return content.relative
|
||||
}
|
||||
|
||||
return config.future?.relativeContentPathsByDefault ?? false
|
||||
})(),
|
||||
|
||||
files: (() => {
|
||||
let { content, purge } = config
|
||||
|
||||
if (Array.isArray(purge)) return purge
|
||||
if (Array.isArray(purge?.content)) return purge.content
|
||||
if (Array.isArray(content)) return content
|
||||
if (Array.isArray(content?.content)) return content.content
|
||||
if (Array.isArray(content?.files)) return content.files
|
||||
|
||||
return []
|
||||
})(),
|
||||
|
||||
extract: (() => {
|
||||
let extract = (() => {
|
||||
if (config.purge?.extract) return config.purge.extract
|
||||
if (config.content?.extract) return config.content.extract
|
||||
|
||||
if (config.purge?.extract?.DEFAULT) return config.purge.extract.DEFAULT
|
||||
if (config.content?.extract?.DEFAULT) return config.content.extract.DEFAULT
|
||||
|
||||
if (config.purge?.options?.extractors) return config.purge.options.extractors
|
||||
if (config.content?.options?.extractors) return config.content.options.extractors
|
||||
|
||||
return {}
|
||||
})()
|
||||
|
||||
let extractors = {}
|
||||
|
||||
let defaultExtractor = (() => {
|
||||
if (config.purge?.options?.defaultExtractor) {
|
||||
return config.purge.options.defaultExtractor
|
||||
}
|
||||
|
||||
if (config.content?.options?.defaultExtractor) {
|
||||
return config.content.options.defaultExtractor
|
||||
}
|
||||
|
||||
return undefined
|
||||
})()
|
||||
|
||||
if (defaultExtractor !== undefined) {
|
||||
extractors.DEFAULT = defaultExtractor
|
||||
}
|
||||
|
||||
// Functions
|
||||
if (typeof extract === 'function') {
|
||||
extractors.DEFAULT = extract
|
||||
}
|
||||
|
||||
// Arrays
|
||||
else if (Array.isArray(extract)) {
|
||||
for (let { extensions, extractor } of extract ?? []) {
|
||||
for (let extension of extensions) {
|
||||
extractors[extension] = extractor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Objects
|
||||
else if (typeof extract === 'object' && extract !== null) {
|
||||
Object.assign(extractors, extract)
|
||||
}
|
||||
|
||||
return extractors
|
||||
})(),
|
||||
|
||||
transform: (() => {
|
||||
let transform = (() => {
|
||||
if (config.purge?.transform) return config.purge.transform
|
||||
if (config.content?.transform) return config.content.transform
|
||||
|
||||
if (config.purge?.transform?.DEFAULT) return config.purge.transform.DEFAULT
|
||||
if (config.content?.transform?.DEFAULT) return config.content.transform.DEFAULT
|
||||
|
||||
return {}
|
||||
})()
|
||||
|
||||
let transformers = {}
|
||||
|
||||
if (typeof transform === 'function') {
|
||||
transformers.DEFAULT = transform
|
||||
}
|
||||
|
||||
if (typeof transform === 'object' && transform !== null) {
|
||||
Object.assign(transformers, transform)
|
||||
}
|
||||
|
||||
return transformers
|
||||
})(),
|
||||
}
|
||||
|
||||
// Validate globs to prevent bogus globs.
|
||||
// E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
|
||||
for (let file of config.content.files) {
|
||||
if (typeof file === 'string' && /{([^,]*?)}/g.test(file)) {
|
||||
log.warn('invalid-glob-braces', [
|
||||
`The glob pattern ${dim(file)} in your Tailwind CSS configuration is invalid.`,
|
||||
`Update it to ${dim(file.replace(/{([^,]*?)}/g, '$1'))} to silence this warning.`,
|
||||
// TODO: Add https://tw.wtf/invalid-glob-braces
|
||||
])
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
module.exports = require("./lib/_stream_writable.js")
|
||||
@@ -0,0 +1,7 @@
|
||||
import { EnsureBaseOptions, EnsureIsOptional, EnsureDefault } from '../ensure';
|
||||
|
||||
declare function ensureArrayLength(value: any, options?: EnsureBaseOptions): number;
|
||||
declare function ensureArrayLength(value: any, options?: EnsureBaseOptions & EnsureIsOptional): number | null;
|
||||
declare function ensureArrayLength(value: any, options?: EnsureBaseOptions & EnsureIsOptional & EnsureDefault<number>): number;
|
||||
|
||||
export default ensureArrayLength;
|
||||
@@ -0,0 +1,177 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const net_1 = __importDefault(require("net"));
|
||||
const tls_1 = __importDefault(require("tls"));
|
||||
const url_1 = __importDefault(require("url"));
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const agent_base_1 = require("agent-base");
|
||||
const parse_proxy_response_1 = __importDefault(require("./parse-proxy-response"));
|
||||
const debug = debug_1.default('https-proxy-agent:agent');
|
||||
/**
|
||||
* The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
|
||||
* the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
|
||||
*
|
||||
* Outgoing HTTP requests are first tunneled through the proxy server using the
|
||||
* `CONNECT` HTTP request method to establish a connection to the proxy server,
|
||||
* and then the proxy server connects to the destination target and issues the
|
||||
* HTTP request from the proxy server.
|
||||
*
|
||||
* `https:` requests have their socket connection upgraded to TLS once
|
||||
* the connection to the proxy server has been established.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
class HttpsProxyAgent extends agent_base_1.Agent {
|
||||
constructor(_opts) {
|
||||
let opts;
|
||||
if (typeof _opts === 'string') {
|
||||
opts = url_1.default.parse(_opts);
|
||||
}
|
||||
else {
|
||||
opts = _opts;
|
||||
}
|
||||
if (!opts) {
|
||||
throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!');
|
||||
}
|
||||
debug('creating new HttpsProxyAgent instance: %o', opts);
|
||||
super(opts);
|
||||
const proxy = Object.assign({}, opts);
|
||||
// If `true`, then connect to the proxy server over TLS.
|
||||
// Defaults to `false`.
|
||||
this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol);
|
||||
// Prefer `hostname` over `host`, and set the `port` if needed.
|
||||
proxy.host = proxy.hostname || proxy.host;
|
||||
if (typeof proxy.port === 'string') {
|
||||
proxy.port = parseInt(proxy.port, 10);
|
||||
}
|
||||
if (!proxy.port && proxy.host) {
|
||||
proxy.port = this.secureProxy ? 443 : 80;
|
||||
}
|
||||
// ALPN is supported by Node.js >= v5.
|
||||
// attempt to negotiate http/1.1 for proxy servers that support http/2
|
||||
if (this.secureProxy && !('ALPNProtocols' in proxy)) {
|
||||
proxy.ALPNProtocols = ['http 1.1'];
|
||||
}
|
||||
if (proxy.host && proxy.path) {
|
||||
// If both a `host` and `path` are specified then it's most likely
|
||||
// the result of a `url.parse()` call... we need to remove the
|
||||
// `path` portion so that `net.connect()` doesn't attempt to open
|
||||
// that as a Unix socket file.
|
||||
delete proxy.path;
|
||||
delete proxy.pathname;
|
||||
}
|
||||
this.proxy = proxy;
|
||||
}
|
||||
/**
|
||||
* Called when the node-core HTTP client library is creating a
|
||||
* new HTTP request.
|
||||
*
|
||||
* @api protected
|
||||
*/
|
||||
callback(req, opts) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { proxy, secureProxy } = this;
|
||||
// Create a socket connection to the proxy server.
|
||||
let socket;
|
||||
if (secureProxy) {
|
||||
debug('Creating `tls.Socket`: %o', proxy);
|
||||
socket = tls_1.default.connect(proxy);
|
||||
}
|
||||
else {
|
||||
debug('Creating `net.Socket`: %o', proxy);
|
||||
socket = net_1.default.connect(proxy);
|
||||
}
|
||||
const headers = Object.assign({}, proxy.headers);
|
||||
const hostname = `${opts.host}:${opts.port}`;
|
||||
let payload = `CONNECT ${hostname} HTTP/1.1\r\n`;
|
||||
// Inject the `Proxy-Authorization` header if necessary.
|
||||
if (proxy.auth) {
|
||||
headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`;
|
||||
}
|
||||
// The `Host` header should only include the port
|
||||
// number when it is not the default port.
|
||||
let { host, port, secureEndpoint } = opts;
|
||||
if (!isDefaultPort(port, secureEndpoint)) {
|
||||
host += `:${port}`;
|
||||
}
|
||||
headers.Host = host;
|
||||
headers.Connection = 'close';
|
||||
for (const name of Object.keys(headers)) {
|
||||
payload += `${name}: ${headers[name]}\r\n`;
|
||||
}
|
||||
const proxyResponsePromise = parse_proxy_response_1.default(socket);
|
||||
socket.write(`${payload}\r\n`);
|
||||
const { statusCode, buffered } = yield proxyResponsePromise;
|
||||
if (statusCode === 200) {
|
||||
req.once('socket', resume);
|
||||
if (opts.secureEndpoint) {
|
||||
// The proxy is connecting to a TLS server, so upgrade
|
||||
// this socket connection to a TLS connection.
|
||||
debug('Upgrading socket connection to TLS');
|
||||
const servername = opts.servername || opts.host;
|
||||
return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket,
|
||||
servername }));
|
||||
}
|
||||
return socket;
|
||||
}
|
||||
// Some other status code that's not 200... need to re-play the HTTP
|
||||
// header "data" events onto the socket once the HTTP machinery is
|
||||
// attached so that the node core `http` can parse and handle the
|
||||
// error status code.
|
||||
// Close the original socket, and a new "fake" socket is returned
|
||||
// instead, so that the proxy doesn't get the HTTP request
|
||||
// written to it (which may contain `Authorization` headers or other
|
||||
// sensitive data).
|
||||
//
|
||||
// See: https://hackerone.com/reports/541502
|
||||
socket.destroy();
|
||||
const fakeSocket = new net_1.default.Socket({ writable: false });
|
||||
fakeSocket.readable = true;
|
||||
// Need to wait for the "socket" event to re-play the "data" events.
|
||||
req.once('socket', (s) => {
|
||||
debug('replaying proxy buffer for failed request');
|
||||
assert_1.default(s.listenerCount('data') > 0);
|
||||
// Replay the "buffered" Buffer onto the fake `socket`, since at
|
||||
// this point the HTTP module machinery has been hooked up for
|
||||
// the user.
|
||||
s.push(buffered);
|
||||
s.push(null);
|
||||
});
|
||||
return fakeSocket;
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = HttpsProxyAgent;
|
||||
function resume(socket) {
|
||||
socket.resume();
|
||||
}
|
||||
function isDefaultPort(port, secure) {
|
||||
return Boolean((!secure && port === 80) || (secure && port === 443));
|
||||
}
|
||||
function isHTTPS(protocol) {
|
||||
return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false;
|
||||
}
|
||||
function omit(obj, ...keys) {
|
||||
const ret = {};
|
||||
let key;
|
||||
for (key in obj) {
|
||||
if (!keys.includes(key)) {
|
||||
ret[key] = obj[key];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
//# sourceMappingURL=agent.js.map
|
||||
@@ -0,0 +1,5 @@
|
||||
build/
|
||||
test/
|
||||
examples/
|
||||
fs.js
|
||||
zlib.js
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/ecma402-abstract/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oCAAoC,CAAA;AAClD,cAAc,uBAAuB,CAAA;AACrC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,4CAA4C,CAAA;AAC1D,cAAc,+BAA+B,CAAA;AAC7C,cAAc,qCAAqC,CAAA;AACnD,cAAc,sCAAsC,CAAA;AACpD,cAAc,uCAAuC,CAAA;AACrD,cAAc,uCAAuC,CAAA;AACrD,cAAc,4CAA4C,CAAA;AAC1D,cAAc,2CAA2C,CAAA;AACzD,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA;AAC7C,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,gCAAgC,CAAA;AACxE,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAA;AAChB,YAAY,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AAExC,OAAO,EAAC,wBAAwB,EAAC,MAAM,QAAQ,CAAA;AAC/C,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAA;AACjC,YAAY,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AAC5C,cAAc,OAAO,CAAA"}
|
||||
@@ -0,0 +1,25 @@
|
||||
/** Used as references for various `Number` constants. */
|
||||
var MAX_SAFE_INTEGER = 9007199254740991;
|
||||
|
||||
/** Used to detect unsigned integer values. */
|
||||
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
||||
|
||||
/**
|
||||
* Checks if `value` is a valid array-like index.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
||||
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
||||
*/
|
||||
function isIndex(value, length) {
|
||||
var type = typeof value;
|
||||
length = length == null ? MAX_SAFE_INTEGER : length;
|
||||
|
||||
return !!length &&
|
||||
(type == 'number' ||
|
||||
(type != 'symbol' && reIsUint.test(value))) &&
|
||||
(value > -1 && value % 1 == 0 && value < length);
|
||||
}
|
||||
|
||||
module.exports = isIndex;
|
||||
@@ -0,0 +1,75 @@
|
||||
import { Observable } from './Observable';
|
||||
import { EmptyError } from './util/EmptyError';
|
||||
import { SafeSubscriber } from './Subscriber';
|
||||
|
||||
export interface FirstValueFromConfig<T> {
|
||||
defaultValue: T;
|
||||
}
|
||||
|
||||
export function firstValueFrom<T, D>(source: Observable<T>, config: FirstValueFromConfig<D>): Promise<T | D>;
|
||||
export function firstValueFrom<T>(source: Observable<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Converts an observable to a promise by subscribing to the observable,
|
||||
* and returning a promise that will resolve as soon as the first value
|
||||
* arrives from the observable. The subscription will then be closed.
|
||||
*
|
||||
* If the observable stream completes before any values were emitted, the
|
||||
* returned promise will reject with {@link EmptyError} or will resolve
|
||||
* with the default value if a default was specified.
|
||||
*
|
||||
* If the observable stream emits an error, the returned promise will reject
|
||||
* with that error.
|
||||
*
|
||||
* **WARNING**: Only use this with observables you *know* will emit at least one value,
|
||||
* *OR* complete. If the source observable does not emit one value or complete, you will
|
||||
* end up with a promise that is hung up, and potentially all of the state of an
|
||||
* async function hanging out in memory. To avoid this situation, look into adding
|
||||
* something like {@link timeout}, {@link take}, {@link takeWhile}, or {@link takeUntil}
|
||||
* amongst others.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Wait for the first value from a stream and emit it from a promise in
|
||||
* an async function
|
||||
*
|
||||
* ```ts
|
||||
* import { interval, firstValueFrom } from 'rxjs';
|
||||
*
|
||||
* async function execute() {
|
||||
* const source$ = interval(2000);
|
||||
* const firstNumber = await firstValueFrom(source$);
|
||||
* console.log(`The first number is ${ firstNumber }`);
|
||||
* }
|
||||
*
|
||||
* execute();
|
||||
*
|
||||
* // Expected output:
|
||||
* // 'The first number is 0'
|
||||
* ```
|
||||
*
|
||||
* @see {@link lastValueFrom}
|
||||
*
|
||||
* @param source the observable to convert to a promise
|
||||
* @param config a configuration object to define the `defaultValue` to use if the source completes without emitting a value
|
||||
*/
|
||||
export function firstValueFrom<T, D>(source: Observable<T>, config?: FirstValueFromConfig<D>): Promise<T | D> {
|
||||
const hasConfig = typeof config === 'object';
|
||||
return new Promise<T | D>((resolve, reject) => {
|
||||
const subscriber = new SafeSubscriber<T>({
|
||||
next: (value) => {
|
||||
resolve(value);
|
||||
subscriber.unsubscribe();
|
||||
},
|
||||
error: reject,
|
||||
complete: () => {
|
||||
if (hasConfig) {
|
||||
resolve(config!.defaultValue);
|
||||
} else {
|
||||
reject(new EmptyError());
|
||||
}
|
||||
},
|
||||
});
|
||||
source.subscribe(subscriber);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
----
|
||||
|
||||
This library bundles a version of the `fs.realpath` and `fs.realpathSync`
|
||||
methods from Node.js v0.10 under the terms of the Node.js MIT license.
|
||||
|
||||
Node's license follows, also included at the header of `old.js` which contains
|
||||
the licensed code:
|
||||
|
||||
Copyright Joyent, Inc. and other Node 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.
|
||||
@@ -0,0 +1,2 @@
|
||||
var n=require("preact");"undefined"!=typeof window&&window.__PREACT_DEVTOOLS__&&window.__PREACT_DEVTOOLS__.attachPreact("10.12.1",n.options,{Fragment:n.Fragment,Component:n.Component}),exports.addHookName=function(e,o){return n.options.__a&&n.options.__a(o),e};
|
||||
//# sourceMappingURL=devtools.js.map
|
||||
@@ -0,0 +1,3 @@
|
||||
/// <reference types="node" />
|
||||
import { Readable } from 'stream';
|
||||
export declare function merge(streams: Readable[]): NodeJS.ReadableStream;
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference types="node" />
|
||||
import type * as fs from 'fs';
|
||||
export interface Entry {
|
||||
dirent: Dirent;
|
||||
name: string;
|
||||
path: string;
|
||||
stats?: Stats;
|
||||
}
|
||||
export declare type Stats = fs.Stats;
|
||||
export declare type ErrnoException = NodeJS.ErrnoException;
|
||||
export interface Dirent {
|
||||
isBlockDevice: () => boolean;
|
||||
isCharacterDevice: () => boolean;
|
||||
isDirectory: () => boolean;
|
||||
isFIFO: () => boolean;
|
||||
isFile: () => boolean;
|
||||
isSocket: () => boolean;
|
||||
isSymbolicLink: () => boolean;
|
||||
name: string;
|
||||
}
|
||||
@@ -0,0 +1,595 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
var async = require('../async');
|
||||
|
||||
test('`./async` entry point', function (t) {
|
||||
t.equal(resolve, async, '`./async` entry point is the same as `main`');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('async foo', function (t) {
|
||||
t.plan(12);
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./foo', { basedir: dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'foo.js'));
|
||||
t.equal(pkg && pkg.name, 'resolve');
|
||||
});
|
||||
|
||||
resolve('./foo.js', { basedir: dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'foo.js'));
|
||||
t.equal(pkg && pkg.name, 'resolve');
|
||||
});
|
||||
|
||||
resolve('./foo', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'foo.js'));
|
||||
t.equal(pkg && pkg.main, 'resolver');
|
||||
});
|
||||
|
||||
resolve('./foo.js', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'foo.js'));
|
||||
t.equal(pkg.main, 'resolver');
|
||||
});
|
||||
|
||||
resolve('./foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'foo.js'));
|
||||
});
|
||||
|
||||
resolve('foo', { basedir: dir }, function (err) {
|
||||
t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
|
||||
// Test that filename is reported as the "from" value when passed.
|
||||
resolve('foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err) {
|
||||
t.equal(err.message, "Cannot find module 'foo' from '" + path.join(dir, 'baz.js') + "'");
|
||||
});
|
||||
});
|
||||
|
||||
test('bar', function (t) {
|
||||
t.plan(6);
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('foo', { basedir: dir + '/bar', 'package': { main: 'bar' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js'));
|
||||
t.equal(pkg.main, 'bar');
|
||||
});
|
||||
});
|
||||
|
||||
test('baz', function (t) {
|
||||
t.plan(4);
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./baz', { basedir: dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'baz/quux.js'));
|
||||
t.equal(pkg.main, 'quux.js');
|
||||
});
|
||||
|
||||
resolve('./baz', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'baz/quux.js'));
|
||||
t.equal(pkg.main, 'quux.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('biz', function (t) {
|
||||
t.plan(24);
|
||||
var dir = path.join(__dirname, 'resolver/biz/node_modules');
|
||||
|
||||
resolve('./grux', { basedir: dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'grux/index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('./grux', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'grux/index.js'));
|
||||
t.equal(pkg.main, 'biz');
|
||||
});
|
||||
|
||||
resolve('./garply', { basedir: dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'garply/lib/index.js'));
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
|
||||
resolve('./garply', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'garply/lib/index.js'));
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
|
||||
resolve('tiv', { basedir: dir + '/grux' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'tiv/index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('tiv', { basedir: dir + '/grux', 'package': { main: 'grux' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'tiv/index.js'));
|
||||
t.equal(pkg.main, 'grux');
|
||||
});
|
||||
|
||||
resolve('tiv', { basedir: dir + '/garply' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'tiv/index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('tiv', { basedir: dir + '/garply', 'package': { main: './lib' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'tiv/index.js'));
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
|
||||
resolve('grux', { basedir: dir + '/tiv' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'grux/index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('grux', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'grux/index.js'));
|
||||
t.equal(pkg.main, 'tiv');
|
||||
});
|
||||
|
||||
resolve('garply', { basedir: dir + '/tiv' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'garply/lib/index.js'));
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
|
||||
resolve('garply', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'garply/lib/index.js'));
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
});
|
||||
|
||||
test('quux', function (t) {
|
||||
t.plan(2);
|
||||
var dir = path.join(__dirname, 'resolver/quux');
|
||||
|
||||
resolve('./foo', { basedir: dir, 'package': { main: 'quux' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'foo/index.js'));
|
||||
t.equal(pkg.main, 'quux');
|
||||
});
|
||||
});
|
||||
|
||||
test('normalize', function (t) {
|
||||
t.plan(2);
|
||||
var dir = path.join(__dirname, 'resolver/biz/node_modules/grux');
|
||||
|
||||
resolve('../grux', { basedir: dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
});
|
||||
|
||||
test('cup', function (t) {
|
||||
t.plan(5);
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'cup.coffee'));
|
||||
});
|
||||
|
||||
resolve('./cup.coffee', { basedir: dir }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'cup.coffee'));
|
||||
});
|
||||
|
||||
resolve('./cup', { basedir: dir, extensions: ['.js'] }, function (err, res) {
|
||||
t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
|
||||
// Test that filename is reported as the "from" value when passed.
|
||||
resolve('./cup', { basedir: dir, extensions: ['.js'], filename: path.join(dir, 'cupboard.js') }, function (err, res) {
|
||||
t.equal(err.message, "Cannot find module './cup' from '" + path.join(dir, 'cupboard.js') + "'");
|
||||
});
|
||||
});
|
||||
|
||||
test('mug', function (t) {
|
||||
t.plan(3);
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./mug', { basedir: dir }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'mug.js'));
|
||||
});
|
||||
|
||||
resolve('./mug', { basedir: dir, extensions: ['.coffee', '.js'] }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, '/mug.coffee'));
|
||||
});
|
||||
|
||||
resolve('./mug', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) {
|
||||
t.equal(res, path.join(dir, '/mug.js'));
|
||||
});
|
||||
});
|
||||
|
||||
test('other path', function (t) {
|
||||
t.plan(6);
|
||||
var resolverDir = path.join(__dirname, 'resolver');
|
||||
var dir = path.join(resolverDir, 'bar');
|
||||
var otherDir = path.join(resolverDir, 'other_path');
|
||||
|
||||
resolve('root', { basedir: dir, paths: [otherDir] }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(resolverDir, 'other_path/root.js'));
|
||||
});
|
||||
|
||||
resolve('lib/other-lib', { basedir: dir, paths: [otherDir] }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(resolverDir, 'other_path/lib/other-lib.js'));
|
||||
});
|
||||
|
||||
resolve('root', { basedir: dir }, function (err, res) {
|
||||
t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
|
||||
resolve('zzz', { basedir: dir, paths: [otherDir] }, function (err, res) {
|
||||
t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
});
|
||||
|
||||
test('path iterator', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var resolverDir = path.join(__dirname, 'resolver');
|
||||
|
||||
var exactIterator = function (x, start, getPackageCandidates, opts) {
|
||||
return [path.join(resolverDir, x)];
|
||||
};
|
||||
|
||||
resolve('baz', { packageIterator: exactIterator }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(resolverDir, 'baz/quux.js'));
|
||||
t.equal(pkg && pkg.name, 'baz');
|
||||
});
|
||||
});
|
||||
|
||||
test('incorrect main', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var resolverDir = path.join(__dirname, 'resolver');
|
||||
var dir = path.join(resolverDir, 'incorrect_main');
|
||||
|
||||
resolve('./incorrect_main', { basedir: resolverDir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'index.js'));
|
||||
});
|
||||
});
|
||||
|
||||
test('missing index', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var resolverDir = path.join(__dirname, 'resolver');
|
||||
resolve('./missing_index', { basedir: resolverDir }, function (err, res, pkg) {
|
||||
t.ok(err instanceof Error);
|
||||
t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code');
|
||||
});
|
||||
});
|
||||
|
||||
test('missing main', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var resolverDir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./missing_main', { basedir: resolverDir }, function (err, res, pkg) {
|
||||
t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code');
|
||||
});
|
||||
});
|
||||
|
||||
test('null main', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var resolverDir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./null_main', { basedir: resolverDir }, function (err, res, pkg) {
|
||||
t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code');
|
||||
});
|
||||
});
|
||||
|
||||
test('main: false', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var basedir = path.join(__dirname, 'resolver');
|
||||
var dir = path.join(basedir, 'false_main');
|
||||
resolve('./false_main', { basedir: basedir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(
|
||||
res,
|
||||
path.join(dir, 'index.js'),
|
||||
'`"main": false`: resolves to `index.js`'
|
||||
);
|
||||
t.deepEqual(pkg, {
|
||||
name: 'false_main',
|
||||
main: false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('without basedir', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var dir = path.join(__dirname, 'resolver/without_basedir');
|
||||
var tester = require(path.join(dir, 'main.js')); // eslint-disable-line global-require
|
||||
|
||||
tester(t, function (err, res, pkg) {
|
||||
if (err) {
|
||||
t.fail(err);
|
||||
} else {
|
||||
t.equal(res, path.join(dir, 'node_modules/mymodule.js'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./foo', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'same_names/foo.js'));
|
||||
});
|
||||
|
||||
resolve('./foo/', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'same_names/foo/index.js'));
|
||||
});
|
||||
});
|
||||
|
||||
test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'same_names/foo/index.js'));
|
||||
});
|
||||
|
||||
resolve('.', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'same_names/foo/index.js'));
|
||||
});
|
||||
});
|
||||
|
||||
test('async: #121 - treating an existing file as a dir when no basedir', function (t) {
|
||||
var testFile = path.basename(__filename);
|
||||
|
||||
t.test('sanity check', function (st) {
|
||||
st.plan(1);
|
||||
resolve('./' + testFile, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
st.equal(res, __filename, 'sanity check');
|
||||
});
|
||||
});
|
||||
|
||||
t.test('with a fake directory', function (st) {
|
||||
st.plan(4);
|
||||
|
||||
resolve('./' + testFile + '/blah', function (err, res, pkg) {
|
||||
st.ok(err, 'there is an error');
|
||||
st.notOk(res, 'no result');
|
||||
|
||||
st.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve');
|
||||
st.equal(
|
||||
err && err.message,
|
||||
'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'',
|
||||
'can not find nonexistent module'
|
||||
);
|
||||
st.end();
|
||||
});
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('async dot main', function (t) {
|
||||
var start = new Date();
|
||||
t.plan(3);
|
||||
resolve('./resolver/dot_main', function (err, ret) {
|
||||
t.notOk(err);
|
||||
t.equal(ret, path.join(__dirname, 'resolver/dot_main/index.js'));
|
||||
t.ok(new Date() - start < 50, 'resolve.sync timedout');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
test('async dot slash main', function (t) {
|
||||
var start = new Date();
|
||||
t.plan(3);
|
||||
resolve('./resolver/dot_slash_main', function (err, ret) {
|
||||
t.notOk(err);
|
||||
t.equal(ret, path.join(__dirname, 'resolver/dot_slash_main/index.js'));
|
||||
t.ok(new Date() - start < 50, 'resolve.sync timedout');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
test('not a directory', function (t) {
|
||||
t.plan(6);
|
||||
var path = './foo';
|
||||
resolve(path, { basedir: __filename }, function (err, res, pkg) {
|
||||
t.ok(err, 'a non-directory errors');
|
||||
t.equal(arguments.length, 1);
|
||||
t.equal(res, undefined);
|
||||
t.equal(pkg, undefined);
|
||||
|
||||
t.equal(err && err.message, 'Cannot find module \'' + path + '\' from \'' + __filename + '\'');
|
||||
t.equal(err && err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
});
|
||||
|
||||
test('non-string "main" field in package.json', function (t) {
|
||||
t.plan(5);
|
||||
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) {
|
||||
t.ok(err, 'errors on non-string main');
|
||||
t.equal(err.message, 'package “invalid_main” `main` must be a string');
|
||||
t.equal(err.code, 'INVALID_PACKAGE_MAIN');
|
||||
t.equal(res, undefined, 'res is undefined');
|
||||
t.equal(pkg, undefined, 'pkg is undefined');
|
||||
});
|
||||
});
|
||||
|
||||
test('non-string "main" field in package.json', function (t) {
|
||||
t.plan(5);
|
||||
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) {
|
||||
t.ok(err, 'errors on non-string main');
|
||||
t.equal(err.message, 'package “invalid_main” `main` must be a string');
|
||||
t.equal(err.code, 'INVALID_PACKAGE_MAIN');
|
||||
t.equal(res, undefined, 'res is undefined');
|
||||
t.equal(pkg, undefined, 'pkg is undefined');
|
||||
});
|
||||
});
|
||||
|
||||
test('browser field in package.json', function (t) {
|
||||
t.plan(3);
|
||||
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
resolve(
|
||||
'./browser_field',
|
||||
{
|
||||
basedir: dir,
|
||||
packageFilter: function packageFilter(pkg) {
|
||||
if (pkg.browser) {
|
||||
pkg.main = pkg.browser; // eslint-disable-line no-param-reassign
|
||||
delete pkg.browser; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
return pkg;
|
||||
}
|
||||
},
|
||||
function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'browser_field', 'b.js'));
|
||||
t.equal(pkg && pkg.main, 'b');
|
||||
t.equal(pkg && pkg.browser, undefined);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
test('absolute paths', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var extensionless = __filename.slice(0, -path.extname(__filename).length);
|
||||
|
||||
resolve(__filename, function (err, res) {
|
||||
t.equal(
|
||||
res,
|
||||
__filename,
|
||||
'absolute path to this file resolves'
|
||||
);
|
||||
});
|
||||
resolve(extensionless, function (err, res) {
|
||||
t.equal(
|
||||
res,
|
||||
__filename,
|
||||
'extensionless absolute path to this file resolves'
|
||||
);
|
||||
});
|
||||
resolve(__filename, { basedir: process.cwd() }, function (err, res) {
|
||||
t.equal(
|
||||
res,
|
||||
__filename,
|
||||
'absolute path to this file with a basedir resolves'
|
||||
);
|
||||
});
|
||||
resolve(extensionless, { basedir: process.cwd() }, function (err, res) {
|
||||
t.equal(
|
||||
res,
|
||||
__filename,
|
||||
'extensionless absolute path to this file with a basedir resolves'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test('malformed package.json', function (t) {
|
||||
/* eslint operator-linebreak: ["error", "before"], function-paren-newline: "off" */
|
||||
t.plan(
|
||||
(3 * 3) // 3 sets of 3 assertions in the final callback
|
||||
+ 2 // 1 readPackage call with malformed package.json
|
||||
);
|
||||
|
||||
var basedir = path.join(__dirname, 'resolver/malformed_package_json');
|
||||
var expected = path.join(basedir, 'index.js');
|
||||
|
||||
resolve('./index.js', { basedir: basedir }, function (err, res, pkg) {
|
||||
t.error(err, 'no error');
|
||||
t.equal(res, expected, 'malformed package.json is silently ignored');
|
||||
t.equal(pkg, undefined, 'malformed package.json gives an undefined `pkg` argument');
|
||||
});
|
||||
|
||||
resolve(
|
||||
'./index.js',
|
||||
{
|
||||
basedir: basedir,
|
||||
packageFilter: function (pkg, pkgfile, dir) {
|
||||
t.fail('should not reach here');
|
||||
}
|
||||
},
|
||||
function (err, res, pkg) {
|
||||
t.error(err, 'with packageFilter: no error');
|
||||
t.equal(res, expected, 'with packageFilter: malformed package.json is silently ignored');
|
||||
t.equal(pkg, undefined, 'with packageFilter: malformed package.json gives an undefined `pkg` argument');
|
||||
}
|
||||
);
|
||||
|
||||
resolve(
|
||||
'./index.js',
|
||||
{
|
||||
basedir: basedir,
|
||||
readPackage: function (readFile, pkgfile, cb) {
|
||||
t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path');
|
||||
readFile(pkgfile, function (err, result) {
|
||||
try {
|
||||
cb(null, JSON.parse(result));
|
||||
} catch (e) {
|
||||
t.ok(e instanceof SyntaxError, 'readPackage: malformed package.json parses as a syntax error');
|
||||
cb(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
function (err, res, pkg) {
|
||||
t.error(err, 'with readPackage: no error');
|
||||
t.equal(res, expected, 'with readPackage: malformed package.json is silently ignored');
|
||||
t.equal(pkg, undefined, 'with readPackage: malformed package.json gives an undefined `pkg` argument');
|
||||
}
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
var safeToString = require("./safe-to-string");
|
||||
|
||||
var reNewLine = /[\n\r\u2028\u2029]/g;
|
||||
|
||||
module.exports = function (value) {
|
||||
var string = safeToString(value);
|
||||
if (string === null) return "<Non-coercible to string value>";
|
||||
// Trim if too long
|
||||
if (string.length > 100) string = string.slice(0, 99) + "…";
|
||||
// Replace eventual new lines
|
||||
string = string.replace(reNewLine, function (char) {
|
||||
switch (char) {
|
||||
case "\n":
|
||||
return "\\n";
|
||||
case "\r":
|
||||
return "\\r";
|
||||
case "\u2028":
|
||||
return "\\u2028";
|
||||
case "\u2029":
|
||||
return "\\u2029";
|
||||
/* istanbul ignore next */
|
||||
default:
|
||||
throw new Error("Unexpected character");
|
||||
}
|
||||
});
|
||||
return string;
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
import assertString from './util/assertString'; // from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
|
||||
|
||||
var validISO31661Alpha3CountriesCodes = new Set(['AFG', 'ALA', 'ALB', 'DZA', 'ASM', 'AND', 'AGO', 'AIA', 'ATA', 'ATG', 'ARG', 'ARM', 'ABW', 'AUS', 'AUT', 'AZE', 'BHS', 'BHR', 'BGD', 'BRB', 'BLR', 'BEL', 'BLZ', 'BEN', 'BMU', 'BTN', 'BOL', 'BES', 'BIH', 'BWA', 'BVT', 'BRA', 'IOT', 'BRN', 'BGR', 'BFA', 'BDI', 'KHM', 'CMR', 'CAN', 'CPV', 'CYM', 'CAF', 'TCD', 'CHL', 'CHN', 'CXR', 'CCK', 'COL', 'COM', 'COG', 'COD', 'COK', 'CRI', 'CIV', 'HRV', 'CUB', 'CUW', 'CYP', 'CZE', 'DNK', 'DJI', 'DMA', 'DOM', 'ECU', 'EGY', 'SLV', 'GNQ', 'ERI', 'EST', 'ETH', 'FLK', 'FRO', 'FJI', 'FIN', 'FRA', 'GUF', 'PYF', 'ATF', 'GAB', 'GMB', 'GEO', 'DEU', 'GHA', 'GIB', 'GRC', 'GRL', 'GRD', 'GLP', 'GUM', 'GTM', 'GGY', 'GIN', 'GNB', 'GUY', 'HTI', 'HMD', 'VAT', 'HND', 'HKG', 'HUN', 'ISL', 'IND', 'IDN', 'IRN', 'IRQ', 'IRL', 'IMN', 'ISR', 'ITA', 'JAM', 'JPN', 'JEY', 'JOR', 'KAZ', 'KEN', 'KIR', 'PRK', 'KOR', 'KWT', 'KGZ', 'LAO', 'LVA', 'LBN', 'LSO', 'LBR', 'LBY', 'LIE', 'LTU', 'LUX', 'MAC', 'MKD', 'MDG', 'MWI', 'MYS', 'MDV', 'MLI', 'MLT', 'MHL', 'MTQ', 'MRT', 'MUS', 'MYT', 'MEX', 'FSM', 'MDA', 'MCO', 'MNG', 'MNE', 'MSR', 'MAR', 'MOZ', 'MMR', 'NAM', 'NRU', 'NPL', 'NLD', 'NCL', 'NZL', 'NIC', 'NER', 'NGA', 'NIU', 'NFK', 'MNP', 'NOR', 'OMN', 'PAK', 'PLW', 'PSE', 'PAN', 'PNG', 'PRY', 'PER', 'PHL', 'PCN', 'POL', 'PRT', 'PRI', 'QAT', 'REU', 'ROU', 'RUS', 'RWA', 'BLM', 'SHN', 'KNA', 'LCA', 'MAF', 'SPM', 'VCT', 'WSM', 'SMR', 'STP', 'SAU', 'SEN', 'SRB', 'SYC', 'SLE', 'SGP', 'SXM', 'SVK', 'SVN', 'SLB', 'SOM', 'ZAF', 'SGS', 'SSD', 'ESP', 'LKA', 'SDN', 'SUR', 'SJM', 'SWZ', 'SWE', 'CHE', 'SYR', 'TWN', 'TJK', 'TZA', 'THA', 'TLS', 'TGO', 'TKL', 'TON', 'TTO', 'TUN', 'TUR', 'TKM', 'TCA', 'TUV', 'UGA', 'UKR', 'ARE', 'GBR', 'USA', 'UMI', 'URY', 'UZB', 'VUT', 'VEN', 'VNM', 'VGB', 'VIR', 'WLF', 'ESH', 'YEM', 'ZMB', 'ZWE']);
|
||||
export default function isISO31661Alpha3(str) {
|
||||
assertString(str);
|
||||
return validISO31661Alpha3CountriesCodes.has(str.toUpperCase());
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
var Stream = require('stream')
|
||||
|
||||
// through
|
||||
//
|
||||
// a stream that does nothing but re-emit the input.
|
||||
// useful for aggregating a series of changing but not ending streams into one stream)
|
||||
|
||||
exports = module.exports = through
|
||||
through.through = through
|
||||
|
||||
//create a readable writable stream.
|
||||
|
||||
function through (write, end, opts) {
|
||||
write = write || function (data) { this.queue(data) }
|
||||
end = end || function () { this.queue(null) }
|
||||
|
||||
var ended = false, destroyed = false, buffer = [], _ended = false
|
||||
var stream = new Stream()
|
||||
stream.readable = stream.writable = true
|
||||
stream.paused = false
|
||||
|
||||
// stream.autoPause = !(opts && opts.autoPause === false)
|
||||
stream.autoDestroy = !(opts && opts.autoDestroy === false)
|
||||
|
||||
stream.write = function (data) {
|
||||
write.call(this, data)
|
||||
return !stream.paused
|
||||
}
|
||||
|
||||
function drain() {
|
||||
while(buffer.length && !stream.paused) {
|
||||
var data = buffer.shift()
|
||||
if(null === data)
|
||||
return stream.emit('end')
|
||||
else
|
||||
stream.emit('data', data)
|
||||
}
|
||||
}
|
||||
|
||||
stream.queue = stream.push = function (data) {
|
||||
// console.error(ended)
|
||||
if(_ended) return stream
|
||||
if(data === null) _ended = true
|
||||
buffer.push(data)
|
||||
drain()
|
||||
return stream
|
||||
}
|
||||
|
||||
//this will be registered as the first 'end' listener
|
||||
//must call destroy next tick, to make sure we're after any
|
||||
//stream piped from here.
|
||||
//this is only a problem if end is not emitted synchronously.
|
||||
//a nicer way to do this is to make sure this is the last listener for 'end'
|
||||
|
||||
stream.on('end', function () {
|
||||
stream.readable = false
|
||||
if(!stream.writable && stream.autoDestroy)
|
||||
process.nextTick(function () {
|
||||
stream.destroy()
|
||||
})
|
||||
})
|
||||
|
||||
function _end () {
|
||||
stream.writable = false
|
||||
end.call(stream)
|
||||
if(!stream.readable && stream.autoDestroy)
|
||||
stream.destroy()
|
||||
}
|
||||
|
||||
stream.end = function (data) {
|
||||
if(ended) return
|
||||
ended = true
|
||||
if(arguments.length) stream.write(data)
|
||||
_end() // will emit or queue
|
||||
return stream
|
||||
}
|
||||
|
||||
stream.destroy = function () {
|
||||
if(destroyed) return
|
||||
destroyed = true
|
||||
ended = true
|
||||
buffer.length = 0
|
||||
stream.writable = stream.readable = false
|
||||
stream.emit('close')
|
||||
return stream
|
||||
}
|
||||
|
||||
stream.pause = function () {
|
||||
if(stream.paused) return
|
||||
stream.paused = true
|
||||
return stream
|
||||
}
|
||||
|
||||
stream.resume = function () {
|
||||
if(stream.paused) {
|
||||
stream.paused = false
|
||||
stream.emit('resume')
|
||||
}
|
||||
drain()
|
||||
//may have become paused again,
|
||||
//as drain emits 'data'.
|
||||
if(!stream.paused)
|
||||
stream.emit('drain')
|
||||
return stream
|
||||
}
|
||||
return stream
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
var callable = require("./valid-callable")
|
||||
, forEach = require("./for-each")
|
||||
, call = Function.prototype.call;
|
||||
|
||||
module.exports = function (obj, cb /*, thisArg*/) {
|
||||
var result = {}, thisArg = arguments[2];
|
||||
callable(cb);
|
||||
forEach(
|
||||
obj,
|
||||
function (value, key, targetObj, index) {
|
||||
result[call.call(cb, thisArg, key, value, this, index)] = value;
|
||||
},
|
||||
obj
|
||||
);
|
||||
return result;
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* The inverse of `_.toPairs`; this method returns an object composed
|
||||
* from key-value `pairs`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Array
|
||||
* @param {Array} pairs The key-value pairs.
|
||||
* @returns {Object} Returns the new object.
|
||||
* @example
|
||||
*
|
||||
* _.fromPairs([['a', 1], ['b', 2]]);
|
||||
* // => { 'a': 1, 'b': 2 }
|
||||
*/
|
||||
function fromPairs(pairs) {
|
||||
var index = -1,
|
||||
length = pairs == null ? 0 : pairs.length,
|
||||
result = {};
|
||||
|
||||
while (++index < length) {
|
||||
var pair = pairs[index];
|
||||
result[pair[0]] = pair[1];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = fromPairs;
|
||||
@@ -0,0 +1,79 @@
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
import { Subject } from '../Subject';
|
||||
import { SafeSubscriber } from '../Subscriber';
|
||||
import { operate } from '../util/lift';
|
||||
export function share(options = {}) {
|
||||
const { connector = () => new Subject(), resetOnError = true, resetOnComplete = true, resetOnRefCountZero = true } = options;
|
||||
return (wrapperSource) => {
|
||||
let connection;
|
||||
let resetConnection;
|
||||
let subject;
|
||||
let refCount = 0;
|
||||
let hasCompleted = false;
|
||||
let hasErrored = false;
|
||||
const cancelReset = () => {
|
||||
resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
|
||||
resetConnection = undefined;
|
||||
};
|
||||
const reset = () => {
|
||||
cancelReset();
|
||||
connection = subject = undefined;
|
||||
hasCompleted = hasErrored = false;
|
||||
};
|
||||
const resetAndUnsubscribe = () => {
|
||||
const conn = connection;
|
||||
reset();
|
||||
conn === null || conn === void 0 ? void 0 : conn.unsubscribe();
|
||||
};
|
||||
return operate((source, subscriber) => {
|
||||
refCount++;
|
||||
if (!hasErrored && !hasCompleted) {
|
||||
cancelReset();
|
||||
}
|
||||
const dest = (subject = subject !== null && subject !== void 0 ? subject : connector());
|
||||
subscriber.add(() => {
|
||||
refCount--;
|
||||
if (refCount === 0 && !hasErrored && !hasCompleted) {
|
||||
resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);
|
||||
}
|
||||
});
|
||||
dest.subscribe(subscriber);
|
||||
if (!connection &&
|
||||
refCount > 0) {
|
||||
connection = new SafeSubscriber({
|
||||
next: (value) => dest.next(value),
|
||||
error: (err) => {
|
||||
hasErrored = true;
|
||||
cancelReset();
|
||||
resetConnection = handleReset(reset, resetOnError, err);
|
||||
dest.error(err);
|
||||
},
|
||||
complete: () => {
|
||||
hasCompleted = true;
|
||||
cancelReset();
|
||||
resetConnection = handleReset(reset, resetOnComplete);
|
||||
dest.complete();
|
||||
},
|
||||
});
|
||||
innerFrom(source).subscribe(connection);
|
||||
}
|
||||
})(wrapperSource);
|
||||
};
|
||||
}
|
||||
function handleReset(reset, on, ...args) {
|
||||
if (on === true) {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
if (on === false) {
|
||||
return;
|
||||
}
|
||||
const onSubscriber = new SafeSubscriber({
|
||||
next: () => {
|
||||
onSubscriber.unsubscribe();
|
||||
reset();
|
||||
},
|
||||
});
|
||||
return innerFrom(on(...args)).subscribe(onSubscriber);
|
||||
}
|
||||
//# sourceMappingURL=share.js.map
|
||||
@@ -0,0 +1 @@
|
||||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
||||
@@ -0,0 +1,65 @@
|
||||
import { asyncScheduler } from '../scheduler/async';
|
||||
import { MonoTypeOperatorFunction, SchedulerLike } from '../types';
|
||||
import { delayWhen } from './delayWhen';
|
||||
import { timer } from '../observable/timer';
|
||||
|
||||
/**
|
||||
* Delays the emission of items from the source Observable by a given timeout or
|
||||
* until a given Date.
|
||||
*
|
||||
* <span class="informal">Time shifts each item by some specified amount of
|
||||
* milliseconds.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* If the delay argument is a Number, this operator time shifts the source
|
||||
* Observable by that amount of time expressed in milliseconds. The relative
|
||||
* time intervals between the values are preserved.
|
||||
*
|
||||
* If the delay argument is a Date, this operator time shifts the start of the
|
||||
* Observable execution until the given date occurs.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Delay each click by one second
|
||||
*
|
||||
* ```ts
|
||||
* import { fromEvent, delay } from 'rxjs';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const delayedClicks = clicks.pipe(delay(1000)); // each click emitted after 1 second
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* Delay all clicks until a future date happens
|
||||
*
|
||||
* ```ts
|
||||
* import { fromEvent, delay } from 'rxjs';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const date = new Date('March 15, 2050 12:00:00'); // in the future
|
||||
* const delayedClicks = clicks.pipe(delay(date)); // click emitted only after that date
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link delayWhen}
|
||||
* @see {@link throttle}
|
||||
* @see {@link throttleTime}
|
||||
* @see {@link debounce}
|
||||
* @see {@link debounceTime}
|
||||
* @see {@link sample}
|
||||
* @see {@link sampleTime}
|
||||
* @see {@link audit}
|
||||
* @see {@link auditTime}
|
||||
*
|
||||
* @param {number|Date} due The delay duration in milliseconds (a `number`) or
|
||||
* a `Date` until which the emission of the source items is delayed.
|
||||
* @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for
|
||||
* managing the timers that handle the time-shift for each item.
|
||||
* @return A function that returns an Observable that delays the emissions of
|
||||
* the source Observable by the specified timeout or Date.
|
||||
*/
|
||||
export function delay<T>(due: number | Date, scheduler: SchedulerLike = asyncScheduler): MonoTypeOperatorFunction<T> {
|
||||
const duration = timer(due, scheduler);
|
||||
return delayWhen(() => duration);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { PreprocessorGroup } from '../types';
|
||||
declare const _default: () => PreprocessorGroup;
|
||||
export default _default;
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012 James Halliday, Josh Duff, 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.
|
||||
@@ -0,0 +1,21 @@
|
||||
/** Error message constants. */
|
||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
|
||||
/**
|
||||
* The base implementation of `_.delay` and `_.defer` which accepts `args`
|
||||
* to provide to `func`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to delay.
|
||||
* @param {number} wait The number of milliseconds to delay invocation.
|
||||
* @param {Array} args The arguments to provide to `func`.
|
||||
* @returns {number|Object} Returns the timer id or timeout object.
|
||||
*/
|
||||
function baseDelay(func, wait, args) {
|
||||
if (typeof func != 'function') {
|
||||
throw new TypeError(FUNC_ERROR_TEXT);
|
||||
}
|
||||
return setTimeout(function() { func.apply(undefined, args); }, wait);
|
||||
}
|
||||
|
||||
module.exports = baseDelay;
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Detect Electron renderer / nwjs process, which is node, but we should
|
||||
* treat as a browser.
|
||||
*/
|
||||
|
||||
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||||
module.exports = require('./browser.js');
|
||||
} else {
|
||||
module.exports = require('./node.js');
|
||||
}
|
||||
@@ -0,0 +1,923 @@
|
||||
diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js
|
||||
index c5a741c..a2e0d8e 100644
|
||||
--- a/lib/_stream_duplex.js
|
||||
+++ b/lib/_stream_duplex.js
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
module.exports = Duplex;
|
||||
var util = require('util');
|
||||
-var Readable = require('_stream_readable');
|
||||
-var Writable = require('_stream_writable');
|
||||
+var Readable = require('./_stream_readable');
|
||||
+var Writable = require('./_stream_writable');
|
||||
|
||||
util.inherits(Duplex, Readable);
|
||||
|
||||
diff --git a/lib/_stream_passthrough.js b/lib/_stream_passthrough.js
|
||||
index a5e9864..330c247 100644
|
||||
--- a/lib/_stream_passthrough.js
|
||||
+++ b/lib/_stream_passthrough.js
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
module.exports = PassThrough;
|
||||
|
||||
-var Transform = require('_stream_transform');
|
||||
+var Transform = require('./_stream_transform');
|
||||
var util = require('util');
|
||||
util.inherits(PassThrough, Transform);
|
||||
|
||||
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
|
||||
index 0c3fe3e..90a8298 100644
|
||||
--- a/lib/_stream_readable.js
|
||||
+++ b/lib/_stream_readable.js
|
||||
@@ -23,10 +23,34 @@ module.exports = Readable;
|
||||
Readable.ReadableState = ReadableState;
|
||||
|
||||
var EE = require('events').EventEmitter;
|
||||
+if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
|
||||
+ return emitter.listeners(type).length;
|
||||
+};
|
||||
+
|
||||
+if (!global.setImmediate) global.setImmediate = function setImmediate(fn) {
|
||||
+ return setTimeout(fn, 0);
|
||||
+};
|
||||
+if (!global.clearImmediate) global.clearImmediate = function clearImmediate(i) {
|
||||
+ return clearTimeout(i);
|
||||
+};
|
||||
+
|
||||
var Stream = require('stream');
|
||||
var util = require('util');
|
||||
+if (!util.isUndefined) {
|
||||
+ var utilIs = require('core-util-is');
|
||||
+ for (var f in utilIs) {
|
||||
+ util[f] = utilIs[f];
|
||||
+ }
|
||||
+}
|
||||
var StringDecoder;
|
||||
-var debug = util.debuglog('stream');
|
||||
+var debug;
|
||||
+if (util.debuglog)
|
||||
+ debug = util.debuglog('stream');
|
||||
+else try {
|
||||
+ debug = require('debuglog')('stream');
|
||||
+} catch (er) {
|
||||
+ debug = function() {};
|
||||
+}
|
||||
|
||||
util.inherits(Readable, Stream);
|
||||
|
||||
@@ -380,7 +404,7 @@ function chunkInvalid(state, chunk) {
|
||||
|
||||
|
||||
function onEofChunk(stream, state) {
|
||||
- if (state.decoder && !state.ended) {
|
||||
+ if (state.decoder && !state.ended && state.decoder.end) {
|
||||
var chunk = state.decoder.end();
|
||||
if (chunk && chunk.length) {
|
||||
state.buffer.push(chunk);
|
||||
diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js
|
||||
index b1f9fcc..b0caf57 100644
|
||||
--- a/lib/_stream_transform.js
|
||||
+++ b/lib/_stream_transform.js
|
||||
@@ -64,8 +64,14 @@
|
||||
|
||||
module.exports = Transform;
|
||||
|
||||
-var Duplex = require('_stream_duplex');
|
||||
+var Duplex = require('./_stream_duplex');
|
||||
var util = require('util');
|
||||
+if (!util.isUndefined) {
|
||||
+ var utilIs = require('core-util-is');
|
||||
+ for (var f in utilIs) {
|
||||
+ util[f] = utilIs[f];
|
||||
+ }
|
||||
+}
|
||||
util.inherits(Transform, Duplex);
|
||||
|
||||
|
||||
diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js
|
||||
index ba2e920..f49288b 100644
|
||||
--- a/lib/_stream_writable.js
|
||||
+++ b/lib/_stream_writable.js
|
||||
@@ -27,6 +27,12 @@ module.exports = Writable;
|
||||
Writable.WritableState = WritableState;
|
||||
|
||||
var util = require('util');
|
||||
+if (!util.isUndefined) {
|
||||
+ var utilIs = require('core-util-is');
|
||||
+ for (var f in utilIs) {
|
||||
+ util[f] = utilIs[f];
|
||||
+ }
|
||||
+}
|
||||
var Stream = require('stream');
|
||||
|
||||
util.inherits(Writable, Stream);
|
||||
@@ -119,7 +125,7 @@ function WritableState(options, stream) {
|
||||
function Writable(options) {
|
||||
// Writable ctor is applied to Duplexes, though they're not
|
||||
// instanceof Writable, they're instanceof Readable.
|
||||
- if (!(this instanceof Writable) && !(this instanceof Stream.Duplex))
|
||||
+ if (!(this instanceof Writable) && !(this instanceof require('./_stream_duplex')))
|
||||
return new Writable(options);
|
||||
|
||||
this._writableState = new WritableState(options, this);
|
||||
diff --git a/test/simple/test-stream-big-push.js b/test/simple/test-stream-big-push.js
|
||||
index e3787e4..8cd2127 100644
|
||||
--- a/test/simple/test-stream-big-push.js
|
||||
+++ b/test/simple/test-stream-big-push.js
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
-var stream = require('stream');
|
||||
+var stream = require('../../');
|
||||
var str = 'asdfasdfasdfasdfasdf';
|
||||
|
||||
var r = new stream.Readable({
|
||||
diff --git a/test/simple/test-stream-end-paused.js b/test/simple/test-stream-end-paused.js
|
||||
index bb73777..d40efc7 100644
|
||||
--- a/test/simple/test-stream-end-paused.js
|
||||
+++ b/test/simple/test-stream-end-paused.js
|
||||
@@ -25,7 +25,7 @@ var gotEnd = false;
|
||||
|
||||
// Make sure we don't miss the end event for paused 0-length streams
|
||||
|
||||
-var Readable = require('stream').Readable;
|
||||
+var Readable = require('../../').Readable;
|
||||
var stream = new Readable();
|
||||
var calledRead = false;
|
||||
stream._read = function() {
|
||||
diff --git a/test/simple/test-stream-pipe-after-end.js b/test/simple/test-stream-pipe-after-end.js
|
||||
index b46ee90..0be8366 100644
|
||||
--- a/test/simple/test-stream-pipe-after-end.js
|
||||
+++ b/test/simple/test-stream-pipe-after-end.js
|
||||
@@ -22,8 +22,8 @@
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
|
||||
-var Readable = require('_stream_readable');
|
||||
-var Writable = require('_stream_writable');
|
||||
+var Readable = require('../../lib/_stream_readable');
|
||||
+var Writable = require('../../lib/_stream_writable');
|
||||
var util = require('util');
|
||||
|
||||
util.inherits(TestReadable, Readable);
|
||||
diff --git a/test/simple/test-stream-pipe-cleanup.js b/test/simple/test-stream-pipe-cleanup.js
|
||||
deleted file mode 100644
|
||||
index f689358..0000000
|
||||
--- a/test/simple/test-stream-pipe-cleanup.js
|
||||
+++ /dev/null
|
||||
@@ -1,122 +0,0 @@
|
||||
-// Copyright Joyent, Inc. and other Node 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.
|
||||
-
|
||||
-// This test asserts that Stream.prototype.pipe does not leave listeners
|
||||
-// hanging on the source or dest.
|
||||
-
|
||||
-var common = require('../common');
|
||||
-var stream = require('stream');
|
||||
-var assert = require('assert');
|
||||
-var util = require('util');
|
||||
-
|
||||
-function Writable() {
|
||||
- this.writable = true;
|
||||
- this.endCalls = 0;
|
||||
- stream.Stream.call(this);
|
||||
-}
|
||||
-util.inherits(Writable, stream.Stream);
|
||||
-Writable.prototype.end = function() {
|
||||
- this.endCalls++;
|
||||
-};
|
||||
-
|
||||
-Writable.prototype.destroy = function() {
|
||||
- this.endCalls++;
|
||||
-};
|
||||
-
|
||||
-function Readable() {
|
||||
- this.readable = true;
|
||||
- stream.Stream.call(this);
|
||||
-}
|
||||
-util.inherits(Readable, stream.Stream);
|
||||
-
|
||||
-function Duplex() {
|
||||
- this.readable = true;
|
||||
- Writable.call(this);
|
||||
-}
|
||||
-util.inherits(Duplex, Writable);
|
||||
-
|
||||
-var i = 0;
|
||||
-var limit = 100;
|
||||
-
|
||||
-var w = new Writable();
|
||||
-
|
||||
-var r;
|
||||
-
|
||||
-for (i = 0; i < limit; i++) {
|
||||
- r = new Readable();
|
||||
- r.pipe(w);
|
||||
- r.emit('end');
|
||||
-}
|
||||
-assert.equal(0, r.listeners('end').length);
|
||||
-assert.equal(limit, w.endCalls);
|
||||
-
|
||||
-w.endCalls = 0;
|
||||
-
|
||||
-for (i = 0; i < limit; i++) {
|
||||
- r = new Readable();
|
||||
- r.pipe(w);
|
||||
- r.emit('close');
|
||||
-}
|
||||
-assert.equal(0, r.listeners('close').length);
|
||||
-assert.equal(limit, w.endCalls);
|
||||
-
|
||||
-w.endCalls = 0;
|
||||
-
|
||||
-r = new Readable();
|
||||
-
|
||||
-for (i = 0; i < limit; i++) {
|
||||
- w = new Writable();
|
||||
- r.pipe(w);
|
||||
- w.emit('close');
|
||||
-}
|
||||
-assert.equal(0, w.listeners('close').length);
|
||||
-
|
||||
-r = new Readable();
|
||||
-w = new Writable();
|
||||
-var d = new Duplex();
|
||||
-r.pipe(d); // pipeline A
|
||||
-d.pipe(w); // pipeline B
|
||||
-assert.equal(r.listeners('end').length, 2); // A.onend, A.cleanup
|
||||
-assert.equal(r.listeners('close').length, 2); // A.onclose, A.cleanup
|
||||
-assert.equal(d.listeners('end').length, 2); // B.onend, B.cleanup
|
||||
-assert.equal(d.listeners('close').length, 3); // A.cleanup, B.onclose, B.cleanup
|
||||
-assert.equal(w.listeners('end').length, 0);
|
||||
-assert.equal(w.listeners('close').length, 1); // B.cleanup
|
||||
-
|
||||
-r.emit('end');
|
||||
-assert.equal(d.endCalls, 1);
|
||||
-assert.equal(w.endCalls, 0);
|
||||
-assert.equal(r.listeners('end').length, 0);
|
||||
-assert.equal(r.listeners('close').length, 0);
|
||||
-assert.equal(d.listeners('end').length, 2); // B.onend, B.cleanup
|
||||
-assert.equal(d.listeners('close').length, 2); // B.onclose, B.cleanup
|
||||
-assert.equal(w.listeners('end').length, 0);
|
||||
-assert.equal(w.listeners('close').length, 1); // B.cleanup
|
||||
-
|
||||
-d.emit('end');
|
||||
-assert.equal(d.endCalls, 1);
|
||||
-assert.equal(w.endCalls, 1);
|
||||
-assert.equal(r.listeners('end').length, 0);
|
||||
-assert.equal(r.listeners('close').length, 0);
|
||||
-assert.equal(d.listeners('end').length, 0);
|
||||
-assert.equal(d.listeners('close').length, 0);
|
||||
-assert.equal(w.listeners('end').length, 0);
|
||||
-assert.equal(w.listeners('close').length, 0);
|
||||
diff --git a/test/simple/test-stream-pipe-error-handling.js b/test/simple/test-stream-pipe-error-handling.js
|
||||
index c5d724b..c7d6b7d 100644
|
||||
--- a/test/simple/test-stream-pipe-error-handling.js
|
||||
+++ b/test/simple/test-stream-pipe-error-handling.js
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
-var Stream = require('stream').Stream;
|
||||
+var Stream = require('../../').Stream;
|
||||
|
||||
(function testErrorListenerCatches() {
|
||||
var source = new Stream();
|
||||
diff --git a/test/simple/test-stream-pipe-event.js b/test/simple/test-stream-pipe-event.js
|
||||
index cb9d5fe..56f8d61 100644
|
||||
--- a/test/simple/test-stream-pipe-event.js
|
||||
+++ b/test/simple/test-stream-pipe-event.js
|
||||
@@ -20,7 +20,7 @@
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
var common = require('../common');
|
||||
-var stream = require('stream');
|
||||
+var stream = require('../../');
|
||||
var assert = require('assert');
|
||||
var util = require('util');
|
||||
|
||||
diff --git a/test/simple/test-stream-push-order.js b/test/simple/test-stream-push-order.js
|
||||
index f2e6ec2..a5c9bf9 100644
|
||||
--- a/test/simple/test-stream-push-order.js
|
||||
+++ b/test/simple/test-stream-push-order.js
|
||||
@@ -20,7 +20,7 @@
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
var common = require('../common.js');
|
||||
-var Readable = require('stream').Readable;
|
||||
+var Readable = require('../../').Readable;
|
||||
var assert = require('assert');
|
||||
|
||||
var s = new Readable({
|
||||
diff --git a/test/simple/test-stream-push-strings.js b/test/simple/test-stream-push-strings.js
|
||||
index 06f43dc..1701a9a 100644
|
||||
--- a/test/simple/test-stream-push-strings.js
|
||||
+++ b/test/simple/test-stream-push-strings.js
|
||||
@@ -22,7 +22,7 @@
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
|
||||
-var Readable = require('stream').Readable;
|
||||
+var Readable = require('../../').Readable;
|
||||
var util = require('util');
|
||||
|
||||
util.inherits(MyStream, Readable);
|
||||
diff --git a/test/simple/test-stream-readable-event.js b/test/simple/test-stream-readable-event.js
|
||||
index ba6a577..a8e6f7b 100644
|
||||
--- a/test/simple/test-stream-readable-event.js
|
||||
+++ b/test/simple/test-stream-readable-event.js
|
||||
@@ -22,7 +22,7 @@
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
|
||||
-var Readable = require('stream').Readable;
|
||||
+var Readable = require('../../').Readable;
|
||||
|
||||
(function first() {
|
||||
// First test, not reading when the readable is added.
|
||||
diff --git a/test/simple/test-stream-readable-flow-recursion.js b/test/simple/test-stream-readable-flow-recursion.js
|
||||
index 2891ad6..11689ba 100644
|
||||
--- a/test/simple/test-stream-readable-flow-recursion.js
|
||||
+++ b/test/simple/test-stream-readable-flow-recursion.js
|
||||
@@ -27,7 +27,7 @@ var assert = require('assert');
|
||||
// more data continuously, but without triggering a nextTick
|
||||
// warning or RangeError.
|
||||
|
||||
-var Readable = require('stream').Readable;
|
||||
+var Readable = require('../../').Readable;
|
||||
|
||||
// throw an error if we trigger a nextTick warning.
|
||||
process.throwDeprecation = true;
|
||||
diff --git a/test/simple/test-stream-unshift-empty-chunk.js b/test/simple/test-stream-unshift-empty-chunk.js
|
||||
index 0c96476..7827538 100644
|
||||
--- a/test/simple/test-stream-unshift-empty-chunk.js
|
||||
+++ b/test/simple/test-stream-unshift-empty-chunk.js
|
||||
@@ -24,7 +24,7 @@ var assert = require('assert');
|
||||
|
||||
// This test verifies that stream.unshift(Buffer(0)) or
|
||||
// stream.unshift('') does not set state.reading=false.
|
||||
-var Readable = require('stream').Readable;
|
||||
+var Readable = require('../../').Readable;
|
||||
|
||||
var r = new Readable();
|
||||
var nChunks = 10;
|
||||
diff --git a/test/simple/test-stream-unshift-read-race.js b/test/simple/test-stream-unshift-read-race.js
|
||||
index 83fd9fa..17c18aa 100644
|
||||
--- a/test/simple/test-stream-unshift-read-race.js
|
||||
+++ b/test/simple/test-stream-unshift-read-race.js
|
||||
@@ -29,7 +29,7 @@ var assert = require('assert');
|
||||
// 3. push() after the EOF signaling null is an error.
|
||||
// 4. _read() is not called after pushing the EOF null chunk.
|
||||
|
||||
-var stream = require('stream');
|
||||
+var stream = require('../../');
|
||||
var hwm = 10;
|
||||
var r = stream.Readable({ highWaterMark: hwm });
|
||||
var chunks = 10;
|
||||
@@ -51,7 +51,14 @@ r._read = function(n) {
|
||||
|
||||
function push(fast) {
|
||||
assert(!pushedNull, 'push() after null push');
|
||||
- var c = pos >= data.length ? null : data.slice(pos, pos + n);
|
||||
+ var c;
|
||||
+ if (pos >= data.length)
|
||||
+ c = null;
|
||||
+ else {
|
||||
+ if (n + pos > data.length)
|
||||
+ n = data.length - pos;
|
||||
+ c = data.slice(pos, pos + n);
|
||||
+ }
|
||||
pushedNull = c === null;
|
||||
if (fast) {
|
||||
pos += n;
|
||||
diff --git a/test/simple/test-stream-writev.js b/test/simple/test-stream-writev.js
|
||||
index 5b49e6e..b5321f3 100644
|
||||
--- a/test/simple/test-stream-writev.js
|
||||
+++ b/test/simple/test-stream-writev.js
|
||||
@@ -22,7 +22,7 @@
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
|
||||
-var stream = require('stream');
|
||||
+var stream = require('../../');
|
||||
|
||||
var queue = [];
|
||||
for (var decode = 0; decode < 2; decode++) {
|
||||
diff --git a/test/simple/test-stream2-basic.js b/test/simple/test-stream2-basic.js
|
||||
index 3814bf0..248c1be 100644
|
||||
--- a/test/simple/test-stream2-basic.js
|
||||
+++ b/test/simple/test-stream2-basic.js
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
|
||||
var common = require('../common.js');
|
||||
-var R = require('_stream_readable');
|
||||
+var R = require('../../lib/_stream_readable');
|
||||
var assert = require('assert');
|
||||
|
||||
var util = require('util');
|
||||
diff --git a/test/simple/test-stream2-compatibility.js b/test/simple/test-stream2-compatibility.js
|
||||
index 6cdd4e9..f0fa84b 100644
|
||||
--- a/test/simple/test-stream2-compatibility.js
|
||||
+++ b/test/simple/test-stream2-compatibility.js
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
|
||||
var common = require('../common.js');
|
||||
-var R = require('_stream_readable');
|
||||
+var R = require('../../lib/_stream_readable');
|
||||
var assert = require('assert');
|
||||
|
||||
var util = require('util');
|
||||
diff --git a/test/simple/test-stream2-finish-pipe.js b/test/simple/test-stream2-finish-pipe.js
|
||||
index 39b274f..006a19b 100644
|
||||
--- a/test/simple/test-stream2-finish-pipe.js
|
||||
+++ b/test/simple/test-stream2-finish-pipe.js
|
||||
@@ -20,7 +20,7 @@
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
var common = require('../common.js');
|
||||
-var stream = require('stream');
|
||||
+var stream = require('../../');
|
||||
var Buffer = require('buffer').Buffer;
|
||||
|
||||
var r = new stream.Readable();
|
||||
diff --git a/test/simple/test-stream2-fs.js b/test/simple/test-stream2-fs.js
|
||||
deleted file mode 100644
|
||||
index e162406..0000000
|
||||
--- a/test/simple/test-stream2-fs.js
|
||||
+++ /dev/null
|
||||
@@ -1,72 +0,0 @@
|
||||
-// Copyright Joyent, Inc. and other Node 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.
|
||||
-
|
||||
-
|
||||
-var common = require('../common.js');
|
||||
-var R = require('_stream_readable');
|
||||
-var assert = require('assert');
|
||||
-
|
||||
-var fs = require('fs');
|
||||
-var FSReadable = fs.ReadStream;
|
||||
-
|
||||
-var path = require('path');
|
||||
-var file = path.resolve(common.fixturesDir, 'x1024.txt');
|
||||
-
|
||||
-var size = fs.statSync(file).size;
|
||||
-
|
||||
-var expectLengths = [1024];
|
||||
-
|
||||
-var util = require('util');
|
||||
-var Stream = require('stream');
|
||||
-
|
||||
-util.inherits(TestWriter, Stream);
|
||||
-
|
||||
-function TestWriter() {
|
||||
- Stream.apply(this);
|
||||
- this.buffer = [];
|
||||
- this.length = 0;
|
||||
-}
|
||||
-
|
||||
-TestWriter.prototype.write = function(c) {
|
||||
- this.buffer.push(c.toString());
|
||||
- this.length += c.length;
|
||||
- return true;
|
||||
-};
|
||||
-
|
||||
-TestWriter.prototype.end = function(c) {
|
||||
- if (c) this.buffer.push(c.toString());
|
||||
- this.emit('results', this.buffer);
|
||||
-}
|
||||
-
|
||||
-var r = new FSReadable(file);
|
||||
-var w = new TestWriter();
|
||||
-
|
||||
-w.on('results', function(res) {
|
||||
- console.error(res, w.length);
|
||||
- assert.equal(w.length, size);
|
||||
- var l = 0;
|
||||
- assert.deepEqual(res.map(function (c) {
|
||||
- return c.length;
|
||||
- }), expectLengths);
|
||||
- console.log('ok');
|
||||
-});
|
||||
-
|
||||
-r.pipe(w);
|
||||
diff --git a/test/simple/test-stream2-httpclient-response-end.js b/test/simple/test-stream2-httpclient-response-end.js
|
||||
deleted file mode 100644
|
||||
index 15cffc2..0000000
|
||||
--- a/test/simple/test-stream2-httpclient-response-end.js
|
||||
+++ /dev/null
|
||||
@@ -1,52 +0,0 @@
|
||||
-// Copyright Joyent, Inc. and other Node 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.
|
||||
-
|
||||
-var common = require('../common.js');
|
||||
-var assert = require('assert');
|
||||
-var http = require('http');
|
||||
-var msg = 'Hello';
|
||||
-var readable_event = false;
|
||||
-var end_event = false;
|
||||
-var server = http.createServer(function(req, res) {
|
||||
- res.writeHead(200, {'Content-Type': 'text/plain'});
|
||||
- res.end(msg);
|
||||
-}).listen(common.PORT, function() {
|
||||
- http.get({port: common.PORT}, function(res) {
|
||||
- var data = '';
|
||||
- res.on('readable', function() {
|
||||
- console.log('readable event');
|
||||
- readable_event = true;
|
||||
- data += res.read();
|
||||
- });
|
||||
- res.on('end', function() {
|
||||
- console.log('end event');
|
||||
- end_event = true;
|
||||
- assert.strictEqual(msg, data);
|
||||
- server.close();
|
||||
- });
|
||||
- });
|
||||
-});
|
||||
-
|
||||
-process.on('exit', function() {
|
||||
- assert(readable_event);
|
||||
- assert(end_event);
|
||||
-});
|
||||
-
|
||||
diff --git a/test/simple/test-stream2-large-read-stall.js b/test/simple/test-stream2-large-read-stall.js
|
||||
index 2fbfbca..667985b 100644
|
||||
--- a/test/simple/test-stream2-large-read-stall.js
|
||||
+++ b/test/simple/test-stream2-large-read-stall.js
|
||||
@@ -30,7 +30,7 @@ var PUSHSIZE = 20;
|
||||
var PUSHCOUNT = 1000;
|
||||
var HWM = 50;
|
||||
|
||||
-var Readable = require('stream').Readable;
|
||||
+var Readable = require('../../').Readable;
|
||||
var r = new Readable({
|
||||
highWaterMark: HWM
|
||||
});
|
||||
@@ -39,23 +39,23 @@ var rs = r._readableState;
|
||||
r._read = push;
|
||||
|
||||
r.on('readable', function() {
|
||||
- console.error('>> readable');
|
||||
+ //console.error('>> readable');
|
||||
do {
|
||||
- console.error(' > read(%d)', READSIZE);
|
||||
+ //console.error(' > read(%d)', READSIZE);
|
||||
var ret = r.read(READSIZE);
|
||||
- console.error(' < %j (%d remain)', ret && ret.length, rs.length);
|
||||
+ //console.error(' < %j (%d remain)', ret && ret.length, rs.length);
|
||||
} while (ret && ret.length === READSIZE);
|
||||
|
||||
- console.error('<< after read()',
|
||||
- ret && ret.length,
|
||||
- rs.needReadable,
|
||||
- rs.length);
|
||||
+ //console.error('<< after read()',
|
||||
+ // ret && ret.length,
|
||||
+ // rs.needReadable,
|
||||
+ // rs.length);
|
||||
});
|
||||
|
||||
var endEmitted = false;
|
||||
r.on('end', function() {
|
||||
endEmitted = true;
|
||||
- console.error('end');
|
||||
+ //console.error('end');
|
||||
});
|
||||
|
||||
var pushes = 0;
|
||||
@@ -64,11 +64,11 @@ function push() {
|
||||
return;
|
||||
|
||||
if (pushes++ === PUSHCOUNT) {
|
||||
- console.error(' push(EOF)');
|
||||
+ //console.error(' push(EOF)');
|
||||
return r.push(null);
|
||||
}
|
||||
|
||||
- console.error(' push #%d', pushes);
|
||||
+ //console.error(' push #%d', pushes);
|
||||
if (r.push(new Buffer(PUSHSIZE)))
|
||||
setTimeout(push);
|
||||
}
|
||||
diff --git a/test/simple/test-stream2-objects.js b/test/simple/test-stream2-objects.js
|
||||
index 3e6931d..ff47d89 100644
|
||||
--- a/test/simple/test-stream2-objects.js
|
||||
+++ b/test/simple/test-stream2-objects.js
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
|
||||
var common = require('../common.js');
|
||||
-var Readable = require('_stream_readable');
|
||||
-var Writable = require('_stream_writable');
|
||||
+var Readable = require('../../lib/_stream_readable');
|
||||
+var Writable = require('../../lib/_stream_writable');
|
||||
var assert = require('assert');
|
||||
|
||||
// tiny node-tap lookalike.
|
||||
diff --git a/test/simple/test-stream2-pipe-error-handling.js b/test/simple/test-stream2-pipe-error-handling.js
|
||||
index cf7531c..e3f3e4e 100644
|
||||
--- a/test/simple/test-stream2-pipe-error-handling.js
|
||||
+++ b/test/simple/test-stream2-pipe-error-handling.js
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
-var stream = require('stream');
|
||||
+var stream = require('../../');
|
||||
|
||||
(function testErrorListenerCatches() {
|
||||
var count = 1000;
|
||||
diff --git a/test/simple/test-stream2-pipe-error-once-listener.js b/test/simple/test-stream2-pipe-error-once-listener.js
|
||||
index 5e8e3cb..53b2616 100755
|
||||
--- a/test/simple/test-stream2-pipe-error-once-listener.js
|
||||
+++ b/test/simple/test-stream2-pipe-error-once-listener.js
|
||||
@@ -24,7 +24,7 @@ var common = require('../common.js');
|
||||
var assert = require('assert');
|
||||
|
||||
var util = require('util');
|
||||
-var stream = require('stream');
|
||||
+var stream = require('../../');
|
||||
|
||||
|
||||
var Read = function() {
|
||||
diff --git a/test/simple/test-stream2-push.js b/test/simple/test-stream2-push.js
|
||||
index b63edc3..eb2b0e9 100644
|
||||
--- a/test/simple/test-stream2-push.js
|
||||
+++ b/test/simple/test-stream2-push.js
|
||||
@@ -20,7 +20,7 @@
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
var common = require('../common.js');
|
||||
-var stream = require('stream');
|
||||
+var stream = require('../../');
|
||||
var Readable = stream.Readable;
|
||||
var Writable = stream.Writable;
|
||||
var assert = require('assert');
|
||||
diff --git a/test/simple/test-stream2-read-sync-stack.js b/test/simple/test-stream2-read-sync-stack.js
|
||||
index e8a7305..9740a47 100644
|
||||
--- a/test/simple/test-stream2-read-sync-stack.js
|
||||
+++ b/test/simple/test-stream2-read-sync-stack.js
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
-var Readable = require('stream').Readable;
|
||||
+var Readable = require('../../').Readable;
|
||||
var r = new Readable();
|
||||
var N = 256 * 1024;
|
||||
|
||||
diff --git a/test/simple/test-stream2-readable-empty-buffer-no-eof.js b/test/simple/test-stream2-readable-empty-buffer-no-eof.js
|
||||
index cd30178..4b1659d 100644
|
||||
--- a/test/simple/test-stream2-readable-empty-buffer-no-eof.js
|
||||
+++ b/test/simple/test-stream2-readable-empty-buffer-no-eof.js
|
||||
@@ -22,10 +22,9 @@
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
|
||||
-var Readable = require('stream').Readable;
|
||||
+var Readable = require('../../').Readable;
|
||||
|
||||
test1();
|
||||
-test2();
|
||||
|
||||
function test1() {
|
||||
var r = new Readable();
|
||||
@@ -88,31 +87,3 @@ function test1() {
|
||||
console.log('ok');
|
||||
});
|
||||
}
|
||||
-
|
||||
-function test2() {
|
||||
- var r = new Readable({ encoding: 'base64' });
|
||||
- var reads = 5;
|
||||
- r._read = function(n) {
|
||||
- if (!reads--)
|
||||
- return r.push(null); // EOF
|
||||
- else
|
||||
- return r.push(new Buffer('x'));
|
||||
- };
|
||||
-
|
||||
- var results = [];
|
||||
- function flow() {
|
||||
- var chunk;
|
||||
- while (null !== (chunk = r.read()))
|
||||
- results.push(chunk + '');
|
||||
- }
|
||||
- r.on('readable', flow);
|
||||
- r.on('end', function() {
|
||||
- results.push('EOF');
|
||||
- });
|
||||
- flow();
|
||||
-
|
||||
- process.on('exit', function() {
|
||||
- assert.deepEqual(results, [ 'eHh4', 'eHg=', 'EOF' ]);
|
||||
- console.log('ok');
|
||||
- });
|
||||
-}
|
||||
diff --git a/test/simple/test-stream2-readable-from-list.js b/test/simple/test-stream2-readable-from-list.js
|
||||
index 7c96ffe..04a96f5 100644
|
||||
--- a/test/simple/test-stream2-readable-from-list.js
|
||||
+++ b/test/simple/test-stream2-readable-from-list.js
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
var assert = require('assert');
|
||||
var common = require('../common.js');
|
||||
-var fromList = require('_stream_readable')._fromList;
|
||||
+var fromList = require('../../lib/_stream_readable')._fromList;
|
||||
|
||||
// tiny node-tap lookalike.
|
||||
var tests = [];
|
||||
diff --git a/test/simple/test-stream2-readable-legacy-drain.js b/test/simple/test-stream2-readable-legacy-drain.js
|
||||
index 675da8e..51fd3d5 100644
|
||||
--- a/test/simple/test-stream2-readable-legacy-drain.js
|
||||
+++ b/test/simple/test-stream2-readable-legacy-drain.js
|
||||
@@ -22,7 +22,7 @@
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
|
||||
-var Stream = require('stream');
|
||||
+var Stream = require('../../');
|
||||
var Readable = Stream.Readable;
|
||||
|
||||
var r = new Readable();
|
||||
diff --git a/test/simple/test-stream2-readable-non-empty-end.js b/test/simple/test-stream2-readable-non-empty-end.js
|
||||
index 7314ae7..c971898 100644
|
||||
--- a/test/simple/test-stream2-readable-non-empty-end.js
|
||||
+++ b/test/simple/test-stream2-readable-non-empty-end.js
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
var assert = require('assert');
|
||||
var common = require('../common.js');
|
||||
-var Readable = require('_stream_readable');
|
||||
+var Readable = require('../../lib/_stream_readable');
|
||||
|
||||
var len = 0;
|
||||
var chunks = new Array(10);
|
||||
diff --git a/test/simple/test-stream2-readable-wrap-empty.js b/test/simple/test-stream2-readable-wrap-empty.js
|
||||
index 2e5cf25..fd8a3dc 100644
|
||||
--- a/test/simple/test-stream2-readable-wrap-empty.js
|
||||
+++ b/test/simple/test-stream2-readable-wrap-empty.js
|
||||
@@ -22,7 +22,7 @@
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
|
||||
-var Readable = require('_stream_readable');
|
||||
+var Readable = require('../../lib/_stream_readable');
|
||||
var EE = require('events').EventEmitter;
|
||||
|
||||
var oldStream = new EE();
|
||||
diff --git a/test/simple/test-stream2-readable-wrap.js b/test/simple/test-stream2-readable-wrap.js
|
||||
index 90eea01..6b177f7 100644
|
||||
--- a/test/simple/test-stream2-readable-wrap.js
|
||||
+++ b/test/simple/test-stream2-readable-wrap.js
|
||||
@@ -22,8 +22,8 @@
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
|
||||
-var Readable = require('_stream_readable');
|
||||
-var Writable = require('_stream_writable');
|
||||
+var Readable = require('../../lib/_stream_readable');
|
||||
+var Writable = require('../../lib/_stream_writable');
|
||||
var EE = require('events').EventEmitter;
|
||||
|
||||
var testRuns = 0, completedRuns = 0;
|
||||
diff --git a/test/simple/test-stream2-set-encoding.js b/test/simple/test-stream2-set-encoding.js
|
||||
index 5d2c32a..685531b 100644
|
||||
--- a/test/simple/test-stream2-set-encoding.js
|
||||
+++ b/test/simple/test-stream2-set-encoding.js
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
var common = require('../common.js');
|
||||
var assert = require('assert');
|
||||
-var R = require('_stream_readable');
|
||||
+var R = require('../../lib/_stream_readable');
|
||||
var util = require('util');
|
||||
|
||||
// tiny node-tap lookalike.
|
||||
diff --git a/test/simple/test-stream2-transform.js b/test/simple/test-stream2-transform.js
|
||||
index 9c9ddd8..a0cacc6 100644
|
||||
--- a/test/simple/test-stream2-transform.js
|
||||
+++ b/test/simple/test-stream2-transform.js
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
var assert = require('assert');
|
||||
var common = require('../common.js');
|
||||
-var PassThrough = require('_stream_passthrough');
|
||||
-var Transform = require('_stream_transform');
|
||||
+var PassThrough = require('../../').PassThrough;
|
||||
+var Transform = require('../../').Transform;
|
||||
|
||||
// tiny node-tap lookalike.
|
||||
var tests = [];
|
||||
diff --git a/test/simple/test-stream2-unpipe-drain.js b/test/simple/test-stream2-unpipe-drain.js
|
||||
index d66dc3c..365b327 100644
|
||||
--- a/test/simple/test-stream2-unpipe-drain.js
|
||||
+++ b/test/simple/test-stream2-unpipe-drain.js
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
var common = require('../common.js');
|
||||
var assert = require('assert');
|
||||
-var stream = require('stream');
|
||||
+var stream = require('../../');
|
||||
var crypto = require('crypto');
|
||||
|
||||
var util = require('util');
|
||||
diff --git a/test/simple/test-stream2-unpipe-leak.js b/test/simple/test-stream2-unpipe-leak.js
|
||||
index 99f8746..17c92ae 100644
|
||||
--- a/test/simple/test-stream2-unpipe-leak.js
|
||||
+++ b/test/simple/test-stream2-unpipe-leak.js
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
var common = require('../common.js');
|
||||
var assert = require('assert');
|
||||
-var stream = require('stream');
|
||||
+var stream = require('../../');
|
||||
|
||||
var chunk = new Buffer('hallo');
|
||||
|
||||
diff --git a/test/simple/test-stream2-writable.js b/test/simple/test-stream2-writable.js
|
||||
index 704100c..209c3a6 100644
|
||||
--- a/test/simple/test-stream2-writable.js
|
||||
+++ b/test/simple/test-stream2-writable.js
|
||||
@@ -20,8 +20,8 @@
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
var common = require('../common.js');
|
||||
-var W = require('_stream_writable');
|
||||
-var D = require('_stream_duplex');
|
||||
+var W = require('../../').Writable;
|
||||
+var D = require('../../').Duplex;
|
||||
var assert = require('assert');
|
||||
|
||||
var util = require('util');
|
||||
diff --git a/test/simple/test-stream3-pause-then-read.js b/test/simple/test-stream3-pause-then-read.js
|
||||
index b91bde3..2f72c15 100644
|
||||
--- a/test/simple/test-stream3-pause-then-read.js
|
||||
+++ b/test/simple/test-stream3-pause-then-read.js
|
||||
@@ -22,7 +22,7 @@
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
|
||||
-var stream = require('stream');
|
||||
+var stream = require('../../');
|
||||
var Readable = stream.Readable;
|
||||
var Writable = stream.Writable;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const which = require('which');
|
||||
const getPathKey = require('path-key');
|
||||
|
||||
function resolveCommandAttempt(parsed, withoutPathExt) {
|
||||
const env = parsed.options.env || process.env;
|
||||
const cwd = process.cwd();
|
||||
const hasCustomCwd = parsed.options.cwd != null;
|
||||
// Worker threads do not have process.chdir()
|
||||
const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
|
||||
|
||||
// If a custom `cwd` was specified, we need to change the process cwd
|
||||
// because `which` will do stat calls but does not support a custom cwd
|
||||
if (shouldSwitchCwd) {
|
||||
try {
|
||||
process.chdir(parsed.options.cwd);
|
||||
} catch (err) {
|
||||
/* Empty */
|
||||
}
|
||||
}
|
||||
|
||||
let resolved;
|
||||
|
||||
try {
|
||||
resolved = which.sync(parsed.command, {
|
||||
path: env[getPathKey({ env })],
|
||||
pathExt: withoutPathExt ? path.delimiter : undefined,
|
||||
});
|
||||
} catch (e) {
|
||||
/* Empty */
|
||||
} finally {
|
||||
if (shouldSwitchCwd) {
|
||||
process.chdir(cwd);
|
||||
}
|
||||
}
|
||||
|
||||
// If we successfully resolved, ensure that an absolute path is returned
|
||||
// Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
|
||||
if (resolved) {
|
||||
resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
|
||||
}
|
||||
|
||||
return resolved;
|
||||
}
|
||||
|
||||
function resolveCommand(parsed) {
|
||||
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
||||
}
|
||||
|
||||
module.exports = resolveCommand;
|
||||
@@ -0,0 +1,151 @@
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
var utf8 = require('./encoding/utf8'),
|
||||
unicode = require('./encoding/unicode'),
|
||||
mbcs = require('./encoding/mbcs'),
|
||||
sbcs = require('./encoding/sbcs'),
|
||||
iso2022 = require('./encoding/iso2022');
|
||||
|
||||
var self = this;
|
||||
|
||||
var recognisers = [
|
||||
new utf8,
|
||||
new unicode.UTF_16BE,
|
||||
new unicode.UTF_16LE,
|
||||
new unicode.UTF_32BE,
|
||||
new unicode.UTF_32LE,
|
||||
new mbcs.sjis,
|
||||
new mbcs.big5,
|
||||
new mbcs.euc_jp,
|
||||
new mbcs.euc_kr,
|
||||
new mbcs.gb_18030,
|
||||
new iso2022.ISO_2022_JP,
|
||||
new iso2022.ISO_2022_KR,
|
||||
new iso2022.ISO_2022_CN,
|
||||
new sbcs.ISO_8859_1,
|
||||
new sbcs.ISO_8859_2,
|
||||
new sbcs.ISO_8859_5,
|
||||
new sbcs.ISO_8859_6,
|
||||
new sbcs.ISO_8859_7,
|
||||
new sbcs.ISO_8859_8,
|
||||
new sbcs.ISO_8859_9,
|
||||
new sbcs.windows_1251,
|
||||
new sbcs.windows_1256,
|
||||
new sbcs.KOI8_R
|
||||
];
|
||||
|
||||
module.exports.detect = function(buffer, opts) {
|
||||
|
||||
// Tally up the byte occurence statistics.
|
||||
var fByteStats = [];
|
||||
for (var i = 0; i < 256; i++)
|
||||
fByteStats[i] = 0;
|
||||
|
||||
for (var i = buffer.length - 1; i >= 0; i--)
|
||||
fByteStats[buffer[i] & 0x00ff]++;
|
||||
|
||||
var fC1Bytes = false;
|
||||
for (var i = 0x80; i <= 0x9F; i += 1) {
|
||||
if (fByteStats[i] != 0) {
|
||||
fC1Bytes = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var context = {
|
||||
fByteStats: fByteStats,
|
||||
fC1Bytes: fC1Bytes,
|
||||
fRawInput: buffer,
|
||||
fRawLength: buffer.length,
|
||||
fInputBytes: buffer,
|
||||
fInputLen: buffer.length
|
||||
};
|
||||
|
||||
var matches = recognisers.map(function(rec) {
|
||||
return rec.match(context);
|
||||
}).filter(function(match) {
|
||||
return !!match;
|
||||
}).sort(function(a, b) {
|
||||
return b.confidence - a.confidence;
|
||||
});
|
||||
|
||||
if (opts && opts.returnAllMatches === true) {
|
||||
return matches;
|
||||
}
|
||||
else {
|
||||
return matches.length > 0 ? matches[0].name : null;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.detectFile = function(filepath, opts, cb) {
|
||||
if (typeof opts === 'function') {
|
||||
cb = opts;
|
||||
opts = undefined;
|
||||
}
|
||||
|
||||
var fd;
|
||||
|
||||
var handler = function(err, buffer) {
|
||||
if (fd) {
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
|
||||
if (err) return cb(err, null);
|
||||
cb(null, self.detect(buffer, opts));
|
||||
};
|
||||
|
||||
if (opts && opts.sampleSize) {
|
||||
fd = fs.openSync(filepath, 'r'),
|
||||
sample = Buffer.allocUnsafe(opts.sampleSize);
|
||||
|
||||
fs.read(fd, sample, 0, opts.sampleSize, null, function(err) {
|
||||
handler(err, sample);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
fs.readFile(filepath, handler);
|
||||
};
|
||||
|
||||
module.exports.detectFileSync = function(filepath, opts) {
|
||||
if (opts && opts.sampleSize) {
|
||||
var fd = fs.openSync(filepath, 'r'),
|
||||
sample = Buffer.allocUnsafe(opts.sampleSize);
|
||||
|
||||
fs.readSync(fd, sample, 0, opts.sampleSize);
|
||||
fs.closeSync(fd);
|
||||
return self.detect(sample, opts);
|
||||
}
|
||||
|
||||
return self.detect(fs.readFileSync(filepath), opts);
|
||||
};
|
||||
|
||||
// Wrappers for the previous functions to return all encodings
|
||||
module.exports.detectAll = function(buffer, opts) {
|
||||
if (typeof opts !== 'object') {
|
||||
opts = {};
|
||||
}
|
||||
opts.returnAllMatches = true;
|
||||
return self.detect(buffer, opts);
|
||||
}
|
||||
|
||||
module.exports.detectFileAll = function(filepath, opts, cb) {
|
||||
if (typeof opts === 'function') {
|
||||
cb = opts;
|
||||
opts = undefined;
|
||||
}
|
||||
if (typeof opts !== 'object') {
|
||||
opts = {};
|
||||
}
|
||||
opts.returnAllMatches = true;
|
||||
self.detectFile(filepath, opts, cb);
|
||||
}
|
||||
|
||||
module.exports.detectFileAllSync = function(filepath, opts) {
|
||||
if (typeof opts !== 'object') {
|
||||
opts = {};
|
||||
}
|
||||
opts.returnAllMatches = true;
|
||||
return self.detectFileSync(filepath, opts);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"reportUnhandledError.js","sourceRoot":"","sources":["../../../../src/internal/util/reportUnhandledError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAW/D,MAAM,UAAU,oBAAoB,CAAC,GAAQ;IAC3C,eAAe,CAAC,UAAU,CAAC,GAAG,EAAE;QAC9B,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;QACpC,IAAI,gBAAgB,EAAE;YAEpB,gBAAgB,CAAC,GAAG,CAAC,CAAC;SACvB;aAAM;YAEL,MAAM,GAAG,CAAC;SACX;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/types/number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAA;AAEjC,oBAAY,oBAAoB,GAC5B,UAAU,GACV,YAAY,GACZ,aAAa,GACb,SAAS,CAAA;AAEb,oBAAY,wBAAwB,GAChC,mBAAmB,GACnB,gBAAgB,GAChB,iBAAiB,CAAA;AAErB,MAAM,WAAW,wBAAwB;IACvC,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAC/B;AAED,MAAM,WAAW,8BAA8B;IAC7C,oBAAoB,EAAE,MAAM,CAAA;IAC5B,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,YAAY,EAAE,wBAAwB,CAAA;IAEtC,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,EAAE,oBAAoB,CAAA;CAChC;AAGD,oBAAY,mBAAmB,GAAG,UAAU,CAAC,8BAA8B,CAAC,CAAA;AAE5E,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,aAAa,CAAA;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACxC,OAAO,EAAE,aAAa,CAAA;IAEtB,EAAE,EAAE,MAAM,EAAE,CAAA;CACb;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;CAC3C;AAED,MAAM,WAAW,QAAQ;IAEvB,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAA;IAC/B,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAA;IAChC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAA;IAEjC,OAAO,EAAE,MAAM,CAAC,QAAQ,GAAG,OAAO,GAAG,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CACjE;AAID,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAA;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,oBAAY,gBAAgB,GACxB,MAAM,GACN,OAAO,GACP,QAAQ,GACR,SAAS,GACT,UAAU,GACV,WAAW,GACX,YAAY,GACZ,aAAa,GACb,cAAc,GACd,eAAe,GACf,gBAAgB,GAChB,iBAAiB,CAAA;AACrB,oBAAY,eAAe,GAAG,MAAM,CAAA;AAEpC;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,mBAAmB,EAAE,MAAM,CAAA;IAC3B,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,mBAAmB,CAAA;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAA;IAG3D,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,EAAE,CAAA;IAEZ,OAAO,EAAE,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC,CAAA;IAE7C,OAAO,EAAE,MAAM,CACb,eAAe,EACf;QAEE,QAAQ,EAAE,MAAM,CAAA;QAEhB,IAAI,EAAE,MAAM,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAA;QACzD,KAAK,EAAE,MAAM,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAA;KAC3D,CACF,CAAA;IACD,OAAO,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;IACxC,QAAQ,EAAE,MAAM,CAAC,eAAe,EAAE,eAAe,CAAC,CAAA;CACnD;AAED,oBAAY,iBAAiB,CAAC,CAAC,IAAI,IAAI,CACrC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAClC,OAAO,CACR,GAAG;IACF,KAAK,EAAE,CAAC,CAAA;CACT,CAAA;AAED,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,oBAAY,gCAAgC,GAAG,QAAQ,GAAG,UAAU,CAAA;AACpE,oBAAY,wBAAwB,GAChC,SAAS,GACT,SAAS,GACT,UAAU,GACV,MAAM,CAAA;AACV,oBAAY,iCAAiC,GAAG,OAAO,GAAG,MAAM,CAAA;AAChE,oBAAY,kCAAkC,GAC1C,QAAQ,GACR,MAAM,GACN,MAAM,GACN,cAAc,CAAA;AAClB,oBAAY,+BAA+B,GAAG,UAAU,GAAG,YAAY,CAAA;AACvE,oBAAY,2BAA2B,GAAG,oBAAoB,CAAA;AAC9D,oBAAY,8BAA8B,GACtC,MAAM,GACN,QAAQ,GACR,OAAO,GACP,YAAY,CAAA;AAChB,oBAAY,8BAA8B,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;AAExE,MAAM,WAAW,oBAAqB,SAAQ,8BAA8B;IAC1E,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,wBAAwB,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,kCAAkC,CAAA;IACnD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,8BAA8B,CAAA;IAC3C,YAAY,EAAE,+BAA+B,CAAA;IAC7C,QAAQ,EAAE,2BAA2B,CAAA;IACrC,cAAc,EAAE,iCAAiC,CAAA;IACjD,WAAW,EAAE,8BAA8B,CAAA;IAC3C,WAAW,EAAE,OAAO,CAAA;IACpB,EAAE,EAAE,IAAI,CAAC,WAAW,CAAA;IACpB,WAAW,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;IACzC,eAAe,EAAE,MAAM,CAAA;IAEvB,cAAc,EAAE,8BAA8B,CAAA;CAC/C;AAED,oBAAY,mBAAmB,GAAG,IAAI,CACpC,IAAI,CAAC,mBAAmB,EACxB,aAAa,CACd,GACC,wBAAwB,GAAG;IACzB,aAAa,CAAC,EAAE,gCAAgC,CAAA;IAChD,KAAK,CAAC,EAAE,wBAAwB,CAAA;IAChC,cAAc,CAAC,EAAE,iCAAiC,CAAA;IAClD,eAAe,CAAC,EAAE,kCAAkC,CAAA;IACpD,YAAY,CAAC,EAAE,+BAA+B,CAAA;IAC9C,QAAQ,CAAC,EAAE,2BAA2B,CAAA;IACtC,WAAW,CAAC,EAAE,8BAA8B,CAAA;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,8BAA8B,CAAA;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,mBAAmB,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAA;IAC/C,gBAAgB,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,eAAe,CAAA;CAC9D,CAAA;AAEH,oBAAY,2BAA2B,GAAG,IAAI,CAAC,2BAA2B,GACxE,IAAI,CACF,oBAAoB,EAClB,cAAc,GACd,MAAM,GACN,aAAa,GACb,UAAU,GACV,gBAAgB,GAChB,aAAa,CAChB,CAAA;AAEH,oBAAY,qBAAqB,GAC7B,IAAI,CAAC,qBAAqB,GAC1B,mBAAmB,GACnB,mBAAmB,GACnB,iBAAiB,GACjB,SAAS,GACT,MAAM,GACN,SAAS,CAAA;AAEb,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,qBAAqB,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;CACd"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"uglify-js","version":"3.17.4","files":{"LICENSE":{"checkedAt":1678883670005,"integrity":"sha512-ay/kJuKVBmS0j25xbkhkFYS+QPFUf3cLRXUvbbEnW3saCBi6YK0XpUL2DvBJr/ZGJPINR7mXQGYFfBQtPRCsiw==","mode":420,"size":1348},"bin/uglifyjs":{"checkedAt":1678883670009,"integrity":"sha512-XAcLWCB1zonr5jJ8F9tKHSdVf0gO/5nfUCpbYBUhTrqtpG92i45p2ZqDvbC3cD457KQmxjzzoIJSNfLgF13zZw==","mode":420,"size":23662},"tools/domprops.html":{"checkedAt":1678883670010,"integrity":"sha512-j8hx0nWWb01U8plS5mFw5qS943RyIM5Zg6v3a+PK/QlRzTH5Yp3OIefHV1OHEIr/Diu9NR9nMaK3Qlqo6glu0A==","mode":420,"size":13612},"lib/ast.js":{"checkedAt":1678883670016,"integrity":"sha512-OQ2uGDmOpI9UYWN2ZFBijPW9hKQEIZ1/XRi8MfFOgTDLUn+84wN0ibWC1akZUrsngyCImK5JyciCZ7vr6P0sow==","mode":420,"size":84145},"lib/compress.js":{"checkedAt":1678883670066,"integrity":"sha512-sKEw+5yNMJ8HAGOr6YeBcI0ODXMXsC1uA0bT6vUOxIBLjar8h1oC++Tv+ZubCipYMK1QcQu3MvdL3qppf1iKMw==","mode":420,"size":635303},"tools/exports.js":{"checkedAt":1678883670065,"integrity":"sha512-Yxqi8tX2hNMpuXkECAp9Sq8Z3UuMi2HeV9H+ukSp1ltSksvF/w1PfxZMbJ49aA9uxzgq6eY1yBP400NhfrVtqA==","mode":420,"size":270},"lib/minify.js":{"checkedAt":1678883670065,"integrity":"sha512-JVGPszNYHrIbFusLISol6zWIqTjZHlv48quogWohmp8vA4/dql4LEpkJ3+2xWN7KVSCmRIfpkKDYgjJrcQFTIA==","mode":420,"size":11291},"lib/mozilla-ast.js":{"checkedAt":1678883670066,"integrity":"sha512-jUGc33OR5CSYdsm1bBXI8aYYaQfvBZMX6aTCnV+xyXk6D8COs0DbRhyMvryzwZ4/kVvL/chjO9MbB8ALzmXGmw==","mode":420,"size":45957},"tools/node.js":{"checkedAt":1678883670066,"integrity":"sha512-naG4Je2P5T8Qq6p1CWTue4cmusE8kbQOT989XMg7O3m12DnKFmIFBLex76c+mXsy7ZqYA2oIVPzkhfNA4qZ5SQ==","mode":420,"size":3680},"lib/output.js":{"checkedAt":1678883670066,"integrity":"sha512-IVCf50UfOU8WRAzr5vPcaKZEE3VFORMadl/IlcSl0fOqU/WqTbnQcpFfKbNR92wVmoifnJ9MJCPkhaMOpgURcw==","mode":420,"size":66734},"lib/parse.js":{"checkedAt":1678883670068,"integrity":"sha512-OiuS3vmsXawzVX24WSbC1uCuQHjDlvRFEGSHOSIV5TCRUQCbQ5QLvxkxqvrCDiPWIJ3MYFJJs+FbXKl8t25fuw==","mode":420,"size":84241},"lib/propmangle.js":{"checkedAt":1678883670068,"integrity":"sha512-MuUQuPbL5NZIJcA381Ek4IQZOhY1xPIc9HZOca+Ztha9ToJNlcz/nSxlw09Xtah5eaT7nX4PuW6V5N0av5xnDg==","mode":420,"size":10990},"lib/scope.js":{"checkedAt":1678883670068,"integrity":"sha512-ha8uYrl4SmJ75WaKXWBikX0mBnG0BvxIwC5sJZw9sFhbZVZFpd00vE+5F2++ebFf9TUgR6kS0VjK1b870TSmWQ==","mode":420,"size":31374},"lib/sourcemap.js":{"checkedAt":1678883670068,"integrity":"sha512-iK5/mhTS7KOFfRlu/imk/pp6GAuiyzedEVyCumd4/2AUydK2VA1mJez/TPz/jXIE5qdSWLhgdu+myXNvMRvC2w==","mode":420,"size":7057},"lib/transform.js":{"checkedAt":1678883670068,"integrity":"sha512-vk/jjq5egS01enq5ENDAbzsvov4RXQUtsggoOKxB6IE7U/DCeLYYP+OOsoOn/GSFZhhaG4pcZPApSL4ttLHKbQ==","mode":420,"size":9628},"tools/tty.js":{"checkedAt":1678883670068,"integrity":"sha512-OASFeePantvdvBQOhz9M8zD2AR8gry2vU1n4O7C1AONlcrT1UF0KxI9O4XG2REmZm1k7qjBSl7123xMxgc8gwg==","mode":420,"size":758},"lib/utils.js":{"checkedAt":1678883670068,"integrity":"sha512-lsA94v5ohOEEXqYPqtqrkUTQvE+6drGSM2xm6Iax1JwM+wFz1SKcT8WrtRO69FKKWc6zQnjIOAm895GsIrI8UA==","mode":420,"size":8867},"package.json":{"checkedAt":1678883670070,"integrity":"sha512-n4c432+1qR/0pEXiKa1vCgyNhMsx26Iu9SbgkAikYrGUXYtXxTFPGTRmkExIF0aGfhKLDgknC25joMYz+YxDqA==","mode":420,"size":1068},"tools/domprops.json":{"checkedAt":1678883670070,"integrity":"sha512-03Jt5i5RYX0BOmMhtSnJDZD5tTDbu465LqOwFE4QoeynYi+mvHg83JcYZHWNpHvCXPwK2KkSG9ERNez5Y/Kd9Q==","mode":420,"size":183545},"README.md":{"checkedAt":1678883670071,"integrity":"sha512-Jn4tzqpbtssQG4x5l0xdw1s5Jjx/ti7b/G8Lc72Cr4hQ5jqK79vCemd2K19p2IbRq4HLW2UF7OdVffygsE8sJw==","mode":420,"size":57708}}}
|
||||
@@ -0,0 +1,174 @@
|
||||
### esutils [](http://travis-ci.org/estools/esutils)
|
||||
esutils ([esutils](http://github.com/estools/esutils)) is
|
||||
utility box for ECMAScript language tools.
|
||||
|
||||
### API
|
||||
|
||||
### ast
|
||||
|
||||
#### ast.isExpression(node)
|
||||
|
||||
Returns true if `node` is an Expression as defined in ECMA262 edition 5.1 section
|
||||
[11](https://es5.github.io/#x11).
|
||||
|
||||
#### ast.isStatement(node)
|
||||
|
||||
Returns true if `node` is a Statement as defined in ECMA262 edition 5.1 section
|
||||
[12](https://es5.github.io/#x12).
|
||||
|
||||
#### ast.isIterationStatement(node)
|
||||
|
||||
Returns true if `node` is an IterationStatement as defined in ECMA262 edition
|
||||
5.1 section [12.6](https://es5.github.io/#x12.6).
|
||||
|
||||
#### ast.isSourceElement(node)
|
||||
|
||||
Returns true if `node` is a SourceElement as defined in ECMA262 edition 5.1
|
||||
section [14](https://es5.github.io/#x14).
|
||||
|
||||
#### ast.trailingStatement(node)
|
||||
|
||||
Returns `Statement?` if `node` has trailing `Statement`.
|
||||
```js
|
||||
if (cond)
|
||||
consequent;
|
||||
```
|
||||
When taking this `IfStatement`, returns `consequent;` statement.
|
||||
|
||||
#### ast.isProblematicIfStatement(node)
|
||||
|
||||
Returns true if `node` is a problematic IfStatement. If `node` is a problematic `IfStatement`, `node` cannot be represented as an one on one JavaScript code.
|
||||
```js
|
||||
{
|
||||
type: 'IfStatement',
|
||||
consequent: {
|
||||
type: 'WithStatement',
|
||||
body: {
|
||||
type: 'IfStatement',
|
||||
consequent: {type: 'EmptyStatement'}
|
||||
}
|
||||
},
|
||||
alternate: {type: 'EmptyStatement'}
|
||||
}
|
||||
```
|
||||
The above node cannot be represented as a JavaScript code, since the top level `else` alternate belongs to an inner `IfStatement`.
|
||||
|
||||
|
||||
### code
|
||||
|
||||
#### code.isDecimalDigit(code)
|
||||
|
||||
Return true if provided code is decimal digit.
|
||||
|
||||
#### code.isHexDigit(code)
|
||||
|
||||
Return true if provided code is hexadecimal digit.
|
||||
|
||||
#### code.isOctalDigit(code)
|
||||
|
||||
Return true if provided code is octal digit.
|
||||
|
||||
#### code.isWhiteSpace(code)
|
||||
|
||||
Return true if provided code is white space. White space characters are formally defined in ECMA262.
|
||||
|
||||
#### code.isLineTerminator(code)
|
||||
|
||||
Return true if provided code is line terminator. Line terminator characters are formally defined in ECMA262.
|
||||
|
||||
#### code.isIdentifierStart(code)
|
||||
|
||||
Return true if provided code can be the first character of ECMA262 Identifier. They are formally defined in ECMA262.
|
||||
|
||||
#### code.isIdentifierPart(code)
|
||||
|
||||
Return true if provided code can be the trailing character of ECMA262 Identifier. They are formally defined in ECMA262.
|
||||
|
||||
### keyword
|
||||
|
||||
#### keyword.isKeywordES5(id, strict)
|
||||
|
||||
Returns `true` if provided identifier string is a Keyword or Future Reserved Word
|
||||
in ECMA262 edition 5.1. They are formally defined in ECMA262 sections
|
||||
[7.6.1.1](http://es5.github.io/#x7.6.1.1) and [7.6.1.2](http://es5.github.io/#x7.6.1.2),
|
||||
respectively. If the `strict` flag is truthy, this function additionally checks whether
|
||||
`id` is a Keyword or Future Reserved Word under strict mode.
|
||||
|
||||
#### keyword.isKeywordES6(id, strict)
|
||||
|
||||
Returns `true` if provided identifier string is a Keyword or Future Reserved Word
|
||||
in ECMA262 edition 6. They are formally defined in ECMA262 sections
|
||||
[11.6.2.1](http://ecma-international.org/ecma-262/6.0/#sec-keywords) and
|
||||
[11.6.2.2](http://ecma-international.org/ecma-262/6.0/#sec-future-reserved-words),
|
||||
respectively. If the `strict` flag is truthy, this function additionally checks whether
|
||||
`id` is a Keyword or Future Reserved Word under strict mode.
|
||||
|
||||
#### keyword.isReservedWordES5(id, strict)
|
||||
|
||||
Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 5.1.
|
||||
They are formally defined in ECMA262 section [7.6.1](http://es5.github.io/#x7.6.1).
|
||||
If the `strict` flag is truthy, this function additionally checks whether `id`
|
||||
is a Reserved Word under strict mode.
|
||||
|
||||
#### keyword.isReservedWordES6(id, strict)
|
||||
|
||||
Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 6.
|
||||
They are formally defined in ECMA262 section [11.6.2](http://ecma-international.org/ecma-262/6.0/#sec-reserved-words).
|
||||
If the `strict` flag is truthy, this function additionally checks whether `id`
|
||||
is a Reserved Word under strict mode.
|
||||
|
||||
#### keyword.isRestrictedWord(id)
|
||||
|
||||
Returns `true` if provided identifier string is one of `eval` or `arguments`.
|
||||
They are restricted in strict mode code throughout ECMA262 edition 5.1 and
|
||||
in ECMA262 edition 6 section [12.1.1](http://ecma-international.org/ecma-262/6.0/#sec-identifiers-static-semantics-early-errors).
|
||||
|
||||
#### keyword.isIdentifierNameES5(id)
|
||||
|
||||
Return true if provided identifier string is an IdentifierName as specified in
|
||||
ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6).
|
||||
|
||||
#### keyword.isIdentifierNameES6(id)
|
||||
|
||||
Return true if provided identifier string is an IdentifierName as specified in
|
||||
ECMA262 edition 6 section [11.6](http://ecma-international.org/ecma-262/6.0/#sec-names-and-keywords).
|
||||
|
||||
#### keyword.isIdentifierES5(id, strict)
|
||||
|
||||
Return true if provided identifier string is an Identifier as specified in
|
||||
ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6). If the `strict`
|
||||
flag is truthy, this function additionally checks whether `id` is an Identifier
|
||||
under strict mode.
|
||||
|
||||
#### keyword.isIdentifierES6(id, strict)
|
||||
|
||||
Return true if provided identifier string is an Identifier as specified in
|
||||
ECMA262 edition 6 section [12.1](http://ecma-international.org/ecma-262/6.0/#sec-identifiers).
|
||||
If the `strict` flag is truthy, this function additionally checks whether `id`
|
||||
is an Identifier under strict mode.
|
||||
|
||||
### License
|
||||
|
||||
Copyright (C) 2013 [Yusuke Suzuki](http://github.com/Constellation)
|
||||
(twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,82 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* We must remap all the old bits to new bits for each set variant
|
||||
* Only arbitrary variants are considered as those are the only
|
||||
* ones that need to be re-sorted at this time
|
||||
*
|
||||
* An iterated process that removes and sets individual bits simultaneously
|
||||
* will not work because we may have a new bit that is also a later old bit
|
||||
* This means that we would be removing a previously set bit which we don't
|
||||
* want to do
|
||||
*
|
||||
* For example (assume `bN` = `1<<N`)
|
||||
* Given the "total" mapping `[[b1, b3], [b2, b4], [b3, b1], [b4, b2]]`
|
||||
* The mapping is "total" because:
|
||||
* 1. Every input and output is accounted for
|
||||
* 2. All combinations are unique
|
||||
* 3. No one input maps to multiple outputs and vice versa
|
||||
* And, given an offset with all bits set:
|
||||
* V = b1 | b2 | b3 | b4
|
||||
*
|
||||
* Let's explore the issue with removing and setting bits simultaneously:
|
||||
* V & ~b1 | b3 = b2 | b3 | b4
|
||||
* V & ~b2 | b4 = b3 | b4
|
||||
* V & ~b3 | b1 = b1 | b4
|
||||
* V & ~b4 | b2 = b1 | b2
|
||||
*
|
||||
* As you can see, we end up with the wrong result.
|
||||
* This is because we're removing a bit that was previously set.
|
||||
* And, thus the final result is missing b3 and b4.
|
||||
*
|
||||
* Now, let's explore the issue with removing the bits first:
|
||||
* V & ~b1 = b2 | b3 | b4
|
||||
* V & ~b2 = b3 | b4
|
||||
* V & ~b3 = b4
|
||||
* V & ~b4 = 0
|
||||
*
|
||||
* And then setting the bits:
|
||||
* V | b3 = b3
|
||||
* V | b4 = b3 | b4
|
||||
* V | b1 = b1 | b3 | b4
|
||||
* V | b2 = b1 | b2 | b3 | b4
|
||||
*
|
||||
* We get the correct result because we're not removing any bits that were
|
||||
* previously set thus properly remapping the bits to the new order
|
||||
*
|
||||
* To collect this into a single operation that can be done simultaneously
|
||||
* we must first create a mask for the old bits that are set and a mask for
|
||||
* the new bits that are set. Then we can remove the old bits and set the new
|
||||
* bits simultaneously in a "single" operation like so:
|
||||
* OldMask = b1 | b2 | b3 | b4
|
||||
* NewMask = b3 | b4 | b1 | b2
|
||||
*
|
||||
* So this:
|
||||
* V & ~oldMask | newMask
|
||||
*
|
||||
* Expands to this:
|
||||
* V & ~b1 & ~b2 & ~b3 & ~b4 | b3 | b4 | b1 | b2
|
||||
*
|
||||
* Which becomes this:
|
||||
* b1 | b2 | b3 | b4
|
||||
*
|
||||
* Which is the correct result!
|
||||
*
|
||||
* @param {bigint} num
|
||||
* @param {[bigint, bigint][]} mapping
|
||||
*/
|
||||
export function remapBitfield(num, mapping) {
|
||||
// Create masks for the old and new bits that are set
|
||||
let oldMask = 0n
|
||||
let newMask = 0n
|
||||
for (let [oldBit, newBit] of mapping) {
|
||||
if (num & oldBit) {
|
||||
oldMask = oldMask | oldBit
|
||||
newMask = newMask | newBit
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all old bits
|
||||
// Set all new bits
|
||||
return (num & ~oldMask) | newMask
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
var createCaseFirst = require('./_createCaseFirst');
|
||||
|
||||
/**
|
||||
* Converts the first character of `string` to upper case.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to convert.
|
||||
* @returns {string} Returns the converted string.
|
||||
* @example
|
||||
*
|
||||
* _.upperFirst('fred');
|
||||
* // => 'Fred'
|
||||
*
|
||||
* _.upperFirst('FRED');
|
||||
* // => 'FRED'
|
||||
*/
|
||||
var upperFirst = createCaseFirst('toUpperCase');
|
||||
|
||||
module.exports = upperFirst;
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "is-interactive",
|
||||
"version": "2.0.0",
|
||||
"description": "Check if stdout or stderr is interactive",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-interactive",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"interactive",
|
||||
"stdout",
|
||||
"stderr",
|
||||
"detect",
|
||||
"is",
|
||||
"terminal",
|
||||
"shell",
|
||||
"tty"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^15.0.1",
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.39.1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user