new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var requirePromise = require('./requirePromise');
|
||||
|
||||
requirePromise();
|
||||
|
||||
var PromiseResolve = require('es-abstract/2022/PromiseResolve');
|
||||
var Type = require('es-abstract/2022/Type');
|
||||
var iterate = require('iterate-value');
|
||||
var map = require('array.prototype.map');
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var all = callBind(GetIntrinsic('%Promise.all%'));
|
||||
var reject = callBind(GetIntrinsic('%Promise.reject%'));
|
||||
|
||||
module.exports = function allSettled(iterable) {
|
||||
var C = this;
|
||||
if (Type(C) !== 'Object') {
|
||||
throw new TypeError('`this` value must be an object');
|
||||
}
|
||||
var values = iterate(iterable);
|
||||
return all(C, map(values, function (item) {
|
||||
var onFulfill = function (value) {
|
||||
return { status: 'fulfilled', value: value };
|
||||
};
|
||||
var onReject = function (reason) {
|
||||
return { status: 'rejected', reason: reason };
|
||||
};
|
||||
var itemPromise = PromiseResolve(C, item);
|
||||
try {
|
||||
return itemPromise.then(onFulfill, onReject);
|
||||
} catch (e) {
|
||||
return reject(C, e);
|
||||
}
|
||||
}));
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"is-callable","version":"1.2.7","files":{".nycrc":{"checkedAt":1678883669555,"integrity":"sha512-2vm1RFz8Ajl/OYrfoCWPJIm3Bpnf7Gyn5bha/lZx/cq+We3uMy9xj15XeP6x4wF3jf/pO7KMHAkU9mllm605xg==","mode":420,"size":139},"LICENSE":{"checkedAt":1678883671601,"integrity":"sha512-CWRd82wre8E2D9wfNTwrOCxhLsdU7obtQTc4poEGt1uTk93MEI2QW01sXILetqMRgoYp4EIKQZNHNCQrALOFjw==","mode":420,"size":1082},".eslintrc":{"checkedAt":1678883671609,"integrity":"sha512-r/gClhfs/G9e82LPI9tv6I/V8lKqe0ghGH6r9dnzSLDCpeiboPoqY4d5upkFX+Cf+12avtnMjQ0pYNDxxGd9WQ==","mode":420,"size":126},".editorconfig":{"checkedAt":1678883671609,"integrity":"sha512-MtOL1D3AU4U8cBsY3LUHfbjRw+FM4TafKIE+OuZjszh+IcuUc53/HP0JuDv6YXpgWBGTXBUl6BI88nksoDGQ3A==","mode":420,"size":457},"index.js":{"checkedAt":1678883671609,"integrity":"sha512-lFXLjmrnZP8kbSD6sj2xaD0vmNdjDGGq7wSPdQvoTxa2+tqoZNfdcyEEECFtwThluZD92EhhHOu3Bgeo/92dYg==","mode":420,"size":3224},"test/index.js":{"checkedAt":1678883671613,"integrity":"sha512-MEL9L5TMCX0kO5pTaYN/9tAkLnAeWM9p7tEUaIwnSDmT1oYiPVsow2NQMulPfpm8RkDPQZoFK+H0LBgr6ovTww==","mode":420,"size":7944},"package.json":{"checkedAt":1678883671613,"integrity":"sha512-wfgK7dHpqZH4ZZOz0zXtiQ8IeLObb1xlq14yefX9wZAAxs88aoHoSAdy2rLUN7rWmb9uoGBqMOiuEULV+vKE4g==","mode":420,"size":2698},"CHANGELOG.md":{"checkedAt":1678883671613,"integrity":"sha512-b77X6sB5NEoVq4HNCrsnELxsdrXZccoigIB6tz4djDO8duPzyALqMtvLfKlHarSCny8eCuCX8dpGyXkaN6bDKw==","mode":420,"size":9148},"README.md":{"checkedAt":1678883671617,"integrity":"sha512-xME4jJU+0uY3rBxf3cJATLw8wIbpzjAjI6C3NuK9XGI6FhR5TJ/G6PPTaTbFhxa5OP42vw3Paqn7Jr4VgYk2RA==","mode":420,"size":3550},".github/FUNDING.yml":{"checkedAt":1678883671617,"integrity":"sha512-lJagmTnQVYKk/MMK0UnAJhxWUOZIdm9SUErNk/ZDndwJNMpV7vCSMF4vSf+w31+IZsrtOYUwT2sfmxEZ2WV5Ug==","mode":420,"size":582}}}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { lowercaseKeys } from "./util/lowercase-keys";
|
||||
import { mergeDeep } from "./util/merge-deep";
|
||||
import { removeUndefinedProperties } from "./util/remove-undefined-properties";
|
||||
export function merge(defaults, route, options) {
|
||||
if (typeof route === "string") {
|
||||
let [method, url] = route.split(" ");
|
||||
options = Object.assign(url ? { method, url } : { url: method }, options);
|
||||
}
|
||||
else {
|
||||
options = Object.assign({}, route);
|
||||
}
|
||||
// lowercase header names before merging with defaults to avoid duplicates
|
||||
options.headers = lowercaseKeys(options.headers);
|
||||
// remove properties with undefined values before merging
|
||||
removeUndefinedProperties(options);
|
||||
removeUndefinedProperties(options.headers);
|
||||
const mergedOptions = mergeDeep(defaults || {}, options);
|
||||
// mediaType.previews arrays are merged, instead of overwritten
|
||||
if (defaults && defaults.mediaType.previews.length) {
|
||||
mergedOptions.mediaType.previews = defaults.mediaType.previews
|
||||
.filter((preview) => !mergedOptions.mediaType.previews.includes(preview))
|
||||
.concat(mergedOptions.mediaType.previews);
|
||||
}
|
||||
mergedOptions.mediaType.previews = mergedOptions.mediaType.previews.map((preview) => preview.replace(/-preview/, ""));
|
||||
return mergedOptions;
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
import os from 'node:os';
|
||||
import onExit from 'signal-exit';
|
||||
|
||||
const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
|
||||
|
||||
// Monkey-patches `childProcess.kill()` to add `forceKillAfterTimeout` behavior
|
||||
export const spawnedKill = (kill, signal = 'SIGTERM', options = {}) => {
|
||||
const killResult = kill(signal);
|
||||
setKillTimeout(kill, signal, options, killResult);
|
||||
return killResult;
|
||||
};
|
||||
|
||||
const setKillTimeout = (kill, signal, options, killResult) => {
|
||||
if (!shouldForceKill(signal, options, killResult)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const timeout = getForceKillAfterTimeout(options);
|
||||
const t = setTimeout(() => {
|
||||
kill('SIGKILL');
|
||||
}, timeout);
|
||||
|
||||
// Guarded because there's no `.unref()` when `execa` is used in the renderer
|
||||
// process in Electron. This cannot be tested since we don't run tests in
|
||||
// Electron.
|
||||
// istanbul ignore else
|
||||
if (t.unref) {
|
||||
t.unref();
|
||||
}
|
||||
};
|
||||
|
||||
const shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
|
||||
|
||||
const isSigterm = signal => signal === os.constants.signals.SIGTERM
|
||||
|| (typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM');
|
||||
|
||||
const getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => {
|
||||
if (forceKillAfterTimeout === true) {
|
||||
return DEFAULT_FORCE_KILL_TIMEOUT;
|
||||
}
|
||||
|
||||
if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
|
||||
throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
|
||||
}
|
||||
|
||||
return forceKillAfterTimeout;
|
||||
};
|
||||
|
||||
// `childProcess.cancel()`
|
||||
export const spawnedCancel = (spawned, context) => {
|
||||
const killResult = spawned.kill();
|
||||
|
||||
if (killResult) {
|
||||
context.isCanceled = true;
|
||||
}
|
||||
};
|
||||
|
||||
const timeoutKill = (spawned, signal, reject) => {
|
||||
spawned.kill(signal);
|
||||
reject(Object.assign(new Error('Timed out'), {timedOut: true, signal}));
|
||||
};
|
||||
|
||||
// `timeout` option handling
|
||||
export const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise) => {
|
||||
if (timeout === 0 || timeout === undefined) {
|
||||
return spawnedPromise;
|
||||
}
|
||||
|
||||
let timeoutId;
|
||||
const timeoutPromise = new Promise((resolve, reject) => {
|
||||
timeoutId = setTimeout(() => {
|
||||
timeoutKill(spawned, killSignal, reject);
|
||||
}, timeout);
|
||||
});
|
||||
|
||||
const safeSpawnedPromise = spawnedPromise.finally(() => {
|
||||
clearTimeout(timeoutId);
|
||||
});
|
||||
|
||||
return Promise.race([timeoutPromise, safeSpawnedPromise]);
|
||||
};
|
||||
|
||||
export const validateTimeout = ({timeout}) => {
|
||||
if (timeout !== undefined && (!Number.isFinite(timeout) || timeout < 0)) {
|
||||
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
|
||||
}
|
||||
};
|
||||
|
||||
// `cleanup` option handling
|
||||
export const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => {
|
||||
if (!cleanup || detached) {
|
||||
return timedPromise;
|
||||
}
|
||||
|
||||
const removeExitHandler = onExit(() => {
|
||||
spawned.kill();
|
||||
});
|
||||
|
||||
return timedPromise.finally(() => {
|
||||
removeExitHandler();
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,439 @@
|
||||
// @ts-check
|
||||
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import postcssrc from 'postcss-load-config'
|
||||
import { lilconfig } from 'lilconfig'
|
||||
import loadPlugins from 'postcss-load-config/src/plugins' // Little bit scary, looking at private/internal API
|
||||
import loadOptions from 'postcss-load-config/src/options' // Little bit scary, looking at private/internal API
|
||||
|
||||
import tailwind from '../../processTailwindFeatures'
|
||||
import { loadAutoprefixer, loadCssNano, loadPostcss, loadPostcssImport } from './deps'
|
||||
import { formatNodes, drainStdin, outputFile } from './utils'
|
||||
import { env } from '../../lib/sharedState'
|
||||
import resolveConfig from '../../../resolveConfig.js'
|
||||
import getModuleDependencies from '../../lib/getModuleDependencies.js'
|
||||
import { parseCandidateFiles } from '../../lib/content.js'
|
||||
import { createWatcher } from './watching.js'
|
||||
import fastGlob from 'fast-glob'
|
||||
import { findAtConfigPath } from '../../lib/findAtConfigPath.js'
|
||||
import log from '../../util/log'
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} [customPostCssPath ]
|
||||
* @returns
|
||||
*/
|
||||
async function loadPostCssPlugins(customPostCssPath) {
|
||||
let config = customPostCssPath
|
||||
? await (async () => {
|
||||
let file = path.resolve(customPostCssPath)
|
||||
|
||||
// Implementation, see: https://unpkg.com/browse/postcss-load-config@3.1.0/src/index.js
|
||||
// @ts-ignore
|
||||
let { config = {} } = await lilconfig('postcss').load(file)
|
||||
if (typeof config === 'function') {
|
||||
config = config()
|
||||
} else {
|
||||
config = Object.assign({}, config)
|
||||
}
|
||||
|
||||
if (!config.plugins) {
|
||||
config.plugins = []
|
||||
}
|
||||
|
||||
return {
|
||||
file,
|
||||
plugins: loadPlugins(config, file),
|
||||
options: loadOptions(config, file),
|
||||
}
|
||||
})()
|
||||
: await postcssrc()
|
||||
|
||||
let configPlugins = config.plugins
|
||||
|
||||
let configPluginTailwindIdx = configPlugins.findIndex((plugin) => {
|
||||
if (typeof plugin === 'function' && plugin.name === 'tailwindcss') {
|
||||
return true
|
||||
}
|
||||
|
||||
if (typeof plugin === 'object' && plugin !== null && plugin.postcssPlugin === 'tailwindcss') {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
let beforePlugins =
|
||||
configPluginTailwindIdx === -1 ? [] : configPlugins.slice(0, configPluginTailwindIdx)
|
||||
let afterPlugins =
|
||||
configPluginTailwindIdx === -1
|
||||
? configPlugins
|
||||
: configPlugins.slice(configPluginTailwindIdx + 1)
|
||||
|
||||
return [beforePlugins, afterPlugins, config.options]
|
||||
}
|
||||
|
||||
function loadBuiltinPostcssPlugins() {
|
||||
let postcss = loadPostcss()
|
||||
let IMPORT_COMMENT = '__TAILWIND_RESTORE_IMPORT__: '
|
||||
return [
|
||||
[
|
||||
(root) => {
|
||||
root.walkAtRules('import', (rule) => {
|
||||
if (rule.params.slice(1).startsWith('tailwindcss/')) {
|
||||
rule.after(postcss.comment({ text: IMPORT_COMMENT + rule.params }))
|
||||
rule.remove()
|
||||
}
|
||||
})
|
||||
},
|
||||
loadPostcssImport(),
|
||||
(root) => {
|
||||
root.walkComments((rule) => {
|
||||
if (rule.text.startsWith(IMPORT_COMMENT)) {
|
||||
rule.after(
|
||||
postcss.atRule({
|
||||
name: 'import',
|
||||
params: rule.text.replace(IMPORT_COMMENT, ''),
|
||||
})
|
||||
)
|
||||
rule.remove()
|
||||
}
|
||||
})
|
||||
},
|
||||
],
|
||||
[],
|
||||
{},
|
||||
]
|
||||
}
|
||||
|
||||
let state = {
|
||||
/** @type {any} */
|
||||
context: null,
|
||||
|
||||
/** @type {ReturnType<typeof createWatcher> | null} */
|
||||
watcher: null,
|
||||
|
||||
/** @type {{content: string, extension: string}[]} */
|
||||
changedContent: [],
|
||||
|
||||
configDependencies: new Set(),
|
||||
contextDependencies: new Set(),
|
||||
|
||||
/** @type {import('../../lib/content.js').ContentPath[]} */
|
||||
contentPaths: [],
|
||||
|
||||
refreshContentPaths() {
|
||||
this.contentPaths = parseCandidateFiles(this.context, this.context?.tailwindConfig)
|
||||
},
|
||||
|
||||
get config() {
|
||||
return this.context.tailwindConfig
|
||||
},
|
||||
|
||||
get contentPatterns() {
|
||||
return {
|
||||
all: this.contentPaths.map((contentPath) => contentPath.pattern),
|
||||
dynamic: this.contentPaths
|
||||
.filter((contentPath) => contentPath.glob !== undefined)
|
||||
.map((contentPath) => contentPath.pattern),
|
||||
}
|
||||
},
|
||||
|
||||
loadConfig(configPath, content) {
|
||||
if (this.watcher && configPath) {
|
||||
this.refreshConfigDependencies(configPath)
|
||||
}
|
||||
|
||||
let config = configPath ? require(configPath) : {}
|
||||
|
||||
// @ts-ignore
|
||||
config = resolveConfig(config, { content: { files: [] } })
|
||||
|
||||
// Override content files if `--content` has been passed explicitly
|
||||
if (content?.length > 0) {
|
||||
config.content.files = content
|
||||
}
|
||||
|
||||
return config
|
||||
},
|
||||
|
||||
refreshConfigDependencies(configPath) {
|
||||
env.DEBUG && console.time('Module dependencies')
|
||||
|
||||
for (let file of this.configDependencies) {
|
||||
delete require.cache[require.resolve(file)]
|
||||
}
|
||||
|
||||
if (configPath) {
|
||||
let deps = getModuleDependencies(configPath).map(({ file }) => file)
|
||||
|
||||
for (let dependency of deps) {
|
||||
this.configDependencies.add(dependency)
|
||||
}
|
||||
}
|
||||
|
||||
env.DEBUG && console.timeEnd('Module dependencies')
|
||||
},
|
||||
|
||||
readContentPaths() {
|
||||
let content = []
|
||||
|
||||
// Resolve globs from the content config
|
||||
// TODO: When we make the postcss plugin async-capable this can become async
|
||||
let files = fastGlob.sync(this.contentPatterns.all)
|
||||
|
||||
for (let file of files) {
|
||||
if (env.OXIDE) {
|
||||
content.push({
|
||||
file,
|
||||
extension: path.extname(file).slice(1),
|
||||
})
|
||||
} else {
|
||||
content.push({
|
||||
content: fs.readFileSync(path.resolve(file), 'utf8'),
|
||||
extension: path.extname(file).slice(1),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve raw content in the tailwind config
|
||||
let rawContent = this.config.content.files.filter((file) => {
|
||||
return file !== null && typeof file === 'object'
|
||||
})
|
||||
|
||||
for (let { raw: htmlContent, extension = 'html' } of rawContent) {
|
||||
content.push({ content: htmlContent, extension })
|
||||
}
|
||||
|
||||
return content
|
||||
},
|
||||
|
||||
getContext({ createContext, cliConfigPath, root, result, content }) {
|
||||
if (this.context) {
|
||||
this.context.changedContent = this.changedContent.splice(0)
|
||||
|
||||
return this.context
|
||||
}
|
||||
|
||||
env.DEBUG && console.time('Searching for config')
|
||||
let configPath = findAtConfigPath(root, result) ?? cliConfigPath
|
||||
env.DEBUG && console.timeEnd('Searching for config')
|
||||
|
||||
env.DEBUG && console.time('Loading config')
|
||||
let config = this.loadConfig(configPath, content)
|
||||
env.DEBUG && console.timeEnd('Loading config')
|
||||
|
||||
env.DEBUG && console.time('Creating context')
|
||||
this.context = createContext(config, [])
|
||||
Object.assign(this.context, {
|
||||
userConfigPath: configPath,
|
||||
})
|
||||
env.DEBUG && console.timeEnd('Creating context')
|
||||
|
||||
env.DEBUG && console.time('Resolving content paths')
|
||||
this.refreshContentPaths()
|
||||
env.DEBUG && console.timeEnd('Resolving content paths')
|
||||
|
||||
if (this.watcher) {
|
||||
env.DEBUG && console.time('Watch new files')
|
||||
this.watcher.refreshWatchedFiles()
|
||||
env.DEBUG && console.timeEnd('Watch new files')
|
||||
}
|
||||
|
||||
for (let file of this.readContentPaths()) {
|
||||
this.context.changedContent.push(file)
|
||||
}
|
||||
|
||||
return this.context
|
||||
},
|
||||
}
|
||||
|
||||
export async function createProcessor(args, cliConfigPath) {
|
||||
let postcss = loadPostcss()
|
||||
|
||||
let input = args['--input']
|
||||
let output = args['--output']
|
||||
let includePostCss = args['--postcss']
|
||||
let customPostCssPath = typeof args['--postcss'] === 'string' ? args['--postcss'] : undefined
|
||||
|
||||
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss
|
||||
? await loadPostCssPlugins(customPostCssPath)
|
||||
: loadBuiltinPostcssPlugins()
|
||||
|
||||
if (args['--purge']) {
|
||||
log.warn('purge-flag-deprecated', [
|
||||
'The `--purge` flag has been deprecated.',
|
||||
'Please use `--content` instead.',
|
||||
])
|
||||
|
||||
if (!args['--content']) {
|
||||
args['--content'] = args['--purge']
|
||||
}
|
||||
}
|
||||
|
||||
let content = args['--content']?.split(/(?<!{[^}]+),/) ?? []
|
||||
|
||||
let tailwindPlugin = () => {
|
||||
return {
|
||||
postcssPlugin: 'tailwindcss',
|
||||
Once(root, { result }) {
|
||||
env.DEBUG && console.time('Compiling CSS')
|
||||
tailwind(({ createContext }) => {
|
||||
console.error()
|
||||
console.error('Rebuilding...')
|
||||
|
||||
return () => {
|
||||
return state.getContext({
|
||||
createContext,
|
||||
cliConfigPath,
|
||||
root,
|
||||
result,
|
||||
content,
|
||||
})
|
||||
}
|
||||
})(root, result)
|
||||
env.DEBUG && console.timeEnd('Compiling CSS')
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
tailwindPlugin.postcss = true
|
||||
|
||||
let plugins = [
|
||||
...beforePlugins,
|
||||
tailwindPlugin,
|
||||
!args['--minify'] && formatNodes,
|
||||
...afterPlugins,
|
||||
!args['--no-autoprefixer'] && loadAutoprefixer(),
|
||||
args['--minify'] && loadCssNano(),
|
||||
].filter(Boolean)
|
||||
|
||||
/** @type {import('postcss').Processor} */
|
||||
// @ts-ignore
|
||||
let processor = postcss(plugins)
|
||||
|
||||
async function readInput() {
|
||||
// Piping in data, let's drain the stdin
|
||||
if (input === '-') {
|
||||
return drainStdin()
|
||||
}
|
||||
|
||||
// Input file has been provided
|
||||
if (input) {
|
||||
return fs.promises.readFile(path.resolve(input), 'utf8')
|
||||
}
|
||||
|
||||
// No input file provided, fallback to default atrules
|
||||
return '@tailwind base; @tailwind components; @tailwind utilities'
|
||||
}
|
||||
|
||||
async function build() {
|
||||
let start = process.hrtime.bigint()
|
||||
|
||||
return readInput()
|
||||
.then((css) => processor.process(css, { ...postcssOptions, from: input, to: output }))
|
||||
.then((result) => {
|
||||
if (!state.watcher) {
|
||||
return result
|
||||
}
|
||||
|
||||
env.DEBUG && console.time('Recording PostCSS dependencies')
|
||||
for (let message of result.messages) {
|
||||
if (message.type === 'dependency') {
|
||||
state.contextDependencies.add(message.file)
|
||||
}
|
||||
}
|
||||
env.DEBUG && console.timeEnd('Recording PostCSS dependencies')
|
||||
|
||||
// TODO: This needs to be in a different spot
|
||||
env.DEBUG && console.time('Watch new files')
|
||||
state.watcher.refreshWatchedFiles()
|
||||
env.DEBUG && console.timeEnd('Watch new files')
|
||||
|
||||
return result
|
||||
})
|
||||
.then((result) => {
|
||||
if (!output) {
|
||||
process.stdout.write(result.css)
|
||||
return
|
||||
}
|
||||
|
||||
return Promise.all([
|
||||
outputFile(result.opts.to, result.css),
|
||||
result.map && outputFile(result.opts.to + '.map', result.map.toString()),
|
||||
])
|
||||
})
|
||||
.then(() => {
|
||||
let end = process.hrtime.bigint()
|
||||
console.error()
|
||||
console.error('Done in', (end - start) / BigInt(1e6) + 'ms.')
|
||||
})
|
||||
.then(
|
||||
() => {},
|
||||
(err) => {
|
||||
// TODO: If an initial build fails we can't easily pick up any PostCSS dependencies
|
||||
// that were collected before the error occurred
|
||||
// The result is not stored on the error so we have to store it externally
|
||||
// and pull the messages off of it here somehow
|
||||
|
||||
// This results in a less than ideal DX because the watcher will not pick up
|
||||
// changes to imported CSS if one of them caused an error during the initial build
|
||||
// If you fix it and then save the main CSS file so there's no error
|
||||
// The watcher will start watching the imported CSS files and will be
|
||||
// resilient to future errors.
|
||||
|
||||
console.error(err)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{file: string, content(): Promise<string>, extension: string}[]} changes
|
||||
*/
|
||||
async function parseChanges(changes) {
|
||||
return Promise.all(
|
||||
changes.map(async (change) => ({
|
||||
content: await change.content(),
|
||||
extension: change.extension,
|
||||
}))
|
||||
)
|
||||
}
|
||||
|
||||
if (input !== undefined && input !== '-') {
|
||||
state.contextDependencies.add(path.resolve(input))
|
||||
}
|
||||
|
||||
return {
|
||||
build,
|
||||
watch: async () => {
|
||||
state.watcher = createWatcher(args, {
|
||||
state,
|
||||
|
||||
/**
|
||||
* @param {{file: string, content(): Promise<string>, extension: string}[]} changes
|
||||
*/
|
||||
async rebuild(changes) {
|
||||
let needsNewContext = changes.some((change) => {
|
||||
return (
|
||||
state.configDependencies.has(change.file) ||
|
||||
state.contextDependencies.has(change.file)
|
||||
)
|
||||
})
|
||||
|
||||
if (needsNewContext) {
|
||||
state.context = null
|
||||
} else {
|
||||
for (let change of await parseChanges(changes)) {
|
||||
state.changedContent.push(change)
|
||||
}
|
||||
}
|
||||
|
||||
return build()
|
||||
},
|
||||
})
|
||||
|
||||
await build()
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "keyv",
|
||||
"version": "4.5.2",
|
||||
"description": "Simple key-value storage with support for multiple backends",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava --serial",
|
||||
"coverage": "nyc report --reporter=text-lcov > coverage.lcov",
|
||||
"clean": "rm -rf node_modules && rm -rf .nyc_output && rm -rf coverage.lcov && rm -rf ./test/testdb.sqlite"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"unicorn/prefer-module": 0,
|
||||
"unicorn/prefer-node-protocol": 0,
|
||||
"@typescript-eslint/consistent-type-definitions": 0
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jaredwray/keyv.git"
|
||||
},
|
||||
"keywords": [
|
||||
"key",
|
||||
"value",
|
||||
"store",
|
||||
"cache",
|
||||
"ttl"
|
||||
],
|
||||
"author": "Jared Wray <me@jaredwray.com> (http://jaredwray.com)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jaredwray/keyv/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jaredwray/keyv",
|
||||
"dependencies": {
|
||||
"json-buffer": "3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@keyv/test-suite": "*",
|
||||
"ava": "^5.0.1",
|
||||
"eslint": "^8.26.0",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"nyc": "^15.1.0",
|
||||
"pify": "5.0.0",
|
||||
"this": "^1.1.0",
|
||||
"timekeeper": "^2.2.0",
|
||||
"tsd": "^0.24.1",
|
||||
"typescript": "^4.8.4",
|
||||
"xo": "^0.52.4"
|
||||
},
|
||||
"tsd": {
|
||||
"directory": "test"
|
||||
},
|
||||
"types": "./src/index.d.ts",
|
||||
"files": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
module.exports = (flag, argv) => {
|
||||
argv = argv || process.argv;
|
||||
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
||||
const pos = argv.indexOf(prefix + flag);
|
||||
const terminatorPos = argv.indexOf('--');
|
||||
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
||||
};
|
||||
@@ -0,0 +1,102 @@
|
||||
import { Subscription } from '../Subscription';
|
||||
import { OperatorFunction, ObservableInput } from '../types';
|
||||
import { operate } from '../util/lift';
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
import { noop } from '../util/noop';
|
||||
import { arrRemove } from '../util/arrRemove';
|
||||
|
||||
/**
|
||||
* Buffers the source Observable values starting from an emission from
|
||||
* `openings` and ending when the output of `closingSelector` emits.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array. Starts
|
||||
* collecting only when `opening` emits, and calls the `closingSelector`
|
||||
* function to get an Observable that tells when to close the buffer.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Buffers values from the source by opening the buffer via signals from an
|
||||
* Observable provided to `openings`, and closing and sending the buffers when
|
||||
* a Subscribable or Promise returned by the `closingSelector` function emits.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Every other second, emit the click events from the next 500ms
|
||||
*
|
||||
* ```ts
|
||||
* import { fromEvent, interval, bufferToggle, EMPTY } from 'rxjs';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const openings = interval(1000);
|
||||
* const buffered = clicks.pipe(bufferToggle(openings, i =>
|
||||
* i % 2 ? interval(500) : EMPTY
|
||||
* ));
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link buffer}
|
||||
* @see {@link bufferCount}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferWhen}
|
||||
* @see {@link windowToggle}
|
||||
*
|
||||
* @param openings A Subscribable or Promise of notifications to start new
|
||||
* buffers.
|
||||
* @param closingSelector A function that takes
|
||||
* the value emitted by the `openings` observable and returns a Subscribable or Promise,
|
||||
* which, when it emits, signals that the associated buffer should be emitted
|
||||
* and cleared.
|
||||
* @return A function that returns an Observable of arrays of buffered values.
|
||||
*/
|
||||
export function bufferToggle<T, O>(
|
||||
openings: ObservableInput<O>,
|
||||
closingSelector: (value: O) => ObservableInput<any>
|
||||
): OperatorFunction<T, T[]> {
|
||||
return operate((source, subscriber) => {
|
||||
const buffers: T[][] = [];
|
||||
|
||||
// Subscribe to the openings notifier first
|
||||
innerFrom(openings).subscribe(
|
||||
createOperatorSubscriber(
|
||||
subscriber,
|
||||
(openValue) => {
|
||||
const buffer: T[] = [];
|
||||
buffers.push(buffer);
|
||||
// We use this composite subscription, so that
|
||||
// when the closing notifier emits, we can tear it down.
|
||||
const closingSubscription = new Subscription();
|
||||
|
||||
const emitBuffer = () => {
|
||||
arrRemove(buffers, buffer);
|
||||
subscriber.next(buffer);
|
||||
closingSubscription.unsubscribe();
|
||||
};
|
||||
|
||||
// The line below will add the subscription to the parent subscriber *and* the closing subscription.
|
||||
closingSubscription.add(innerFrom(closingSelector(openValue)).subscribe(createOperatorSubscriber(subscriber, emitBuffer, noop)));
|
||||
},
|
||||
noop
|
||||
)
|
||||
);
|
||||
|
||||
source.subscribe(
|
||||
createOperatorSubscriber(
|
||||
subscriber,
|
||||
(value) => {
|
||||
// Value from our source. Add it to all pending buffers.
|
||||
for (const buffer of buffers) {
|
||||
buffer.push(value);
|
||||
}
|
||||
},
|
||||
() => {
|
||||
// Source complete. Emit all pending buffers.
|
||||
while (buffers.length > 0) {
|
||||
subscriber.next(buffers.shift()!);
|
||||
}
|
||||
subscriber.complete();
|
||||
}
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for fileline.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="prettify.css" />
|
||||
<link rel="stylesheet" href="base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="index.html">All files</a> fileline.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { ParseRuntime } from "./ParseRuntime";
|
||||
import getEol from "./getEol";
|
||||
// const getEol = require("./getEol");
|
||||
/**
|
||||
* convert data chunk to file lines array
|
||||
* @param {string} data data chunk as utf8 string
|
||||
* @param {object} param Converter param object
|
||||
* @return {Object} {lines:[line1,line2...],partial:String}
|
||||
*/
|
||||
export function stringToLines(data: string, param: ParseRuntime): StringToLinesResult {
|
||||
const eol = getEol(data, param);
|
||||
const lines = data.split(eol);
|
||||
const partial = lines.pop() || "";
|
||||
return { lines: lines, partial: partial };
|
||||
};
|
||||
|
||||
|
||||
export interface StringToLinesResult {
|
||||
lines: Fileline[],
|
||||
/**
|
||||
* last line which could be incomplete line.
|
||||
*/
|
||||
partial: string
|
||||
}
|
||||
export type Fileline = string;</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Thu May 17 2018 01:25:26 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="sorter.js"></script>
|
||||
<script src="block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.concatMapTo = void 0;
|
||||
var concatMap_1 = require("./concatMap");
|
||||
var isFunction_1 = require("../util/isFunction");
|
||||
function concatMapTo(innerObservable, resultSelector) {
|
||||
return isFunction_1.isFunction(resultSelector) ? concatMap_1.concatMap(function () { return innerObservable; }, resultSelector) : concatMap_1.concatMap(function () { return innerObservable; });
|
||||
}
|
||||
exports.concatMapTo = concatMapTo;
|
||||
//# sourceMappingURL=concatMapTo.js.map
|
||||
@@ -0,0 +1,212 @@
|
||||
var common = require('./common');
|
||||
var _cd = require('./cd');
|
||||
var path = require('path');
|
||||
|
||||
common.register('dirs', _dirs, {
|
||||
wrapOutput: false,
|
||||
});
|
||||
common.register('pushd', _pushd, {
|
||||
wrapOutput: false,
|
||||
});
|
||||
common.register('popd', _popd, {
|
||||
wrapOutput: false,
|
||||
});
|
||||
|
||||
// Pushd/popd/dirs internals
|
||||
var _dirStack = [];
|
||||
|
||||
function _isStackIndex(index) {
|
||||
return (/^[\-+]\d+$/).test(index);
|
||||
}
|
||||
|
||||
function _parseStackIndex(index) {
|
||||
if (_isStackIndex(index)) {
|
||||
if (Math.abs(index) < _dirStack.length + 1) { // +1 for pwd
|
||||
return (/^-/).test(index) ? Number(index) - 1 : Number(index);
|
||||
}
|
||||
common.error(index + ': directory stack index out of range');
|
||||
} else {
|
||||
common.error(index + ': invalid number');
|
||||
}
|
||||
}
|
||||
|
||||
function _actualDirStack() {
|
||||
return [process.cwd()].concat(_dirStack);
|
||||
}
|
||||
|
||||
//@
|
||||
//@ ### pushd([options,] [dir | '-N' | '+N'])
|
||||
//@
|
||||
//@ Available options:
|
||||
//@
|
||||
//@ + `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
|
||||
//@ + `-q`: Supresses output to the console.
|
||||
//@
|
||||
//@ Arguments:
|
||||
//@
|
||||
//@ + `dir`: Sets the current working directory to the top of the stack, then executes the equivalent of `cd dir`.
|
||||
//@ + `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
|
||||
//@ + `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
|
||||
//@
|
||||
//@ Examples:
|
||||
//@
|
||||
//@ ```javascript
|
||||
//@ // process.cwd() === '/usr'
|
||||
//@ pushd('/etc'); // Returns /etc /usr
|
||||
//@ pushd('+1'); // Returns /usr /etc
|
||||
//@ ```
|
||||
//@
|
||||
//@ Save the current directory on the top of the directory stack and then `cd` to `dir`. With no arguments, `pushd` exchanges the top two directories. Returns an array of paths in the stack.
|
||||
function _pushd(options, dir) {
|
||||
if (_isStackIndex(options)) {
|
||||
dir = options;
|
||||
options = '';
|
||||
}
|
||||
|
||||
options = common.parseOptions(options, {
|
||||
'n': 'no-cd',
|
||||
'q': 'quiet',
|
||||
});
|
||||
|
||||
var dirs = _actualDirStack();
|
||||
|
||||
if (dir === '+0') {
|
||||
return dirs; // +0 is a noop
|
||||
} else if (!dir) {
|
||||
if (dirs.length > 1) {
|
||||
dirs = dirs.splice(1, 1).concat(dirs);
|
||||
} else {
|
||||
return common.error('no other directory');
|
||||
}
|
||||
} else if (_isStackIndex(dir)) {
|
||||
var n = _parseStackIndex(dir);
|
||||
dirs = dirs.slice(n).concat(dirs.slice(0, n));
|
||||
} else {
|
||||
if (options['no-cd']) {
|
||||
dirs.splice(1, 0, dir);
|
||||
} else {
|
||||
dirs.unshift(dir);
|
||||
}
|
||||
}
|
||||
|
||||
if (options['no-cd']) {
|
||||
dirs = dirs.slice(1);
|
||||
} else {
|
||||
dir = path.resolve(dirs.shift());
|
||||
_cd('', dir);
|
||||
}
|
||||
|
||||
_dirStack = dirs;
|
||||
return _dirs(options.quiet ? '-q' : '');
|
||||
}
|
||||
exports.pushd = _pushd;
|
||||
|
||||
//@
|
||||
//@
|
||||
//@ ### popd([options,] ['-N' | '+N'])
|
||||
//@
|
||||
//@ Available options:
|
||||
//@
|
||||
//@ + `-n`: Suppress the normal directory change when removing directories from the stack, so that only the stack is manipulated.
|
||||
//@ + `-q`: Supresses output to the console.
|
||||
//@
|
||||
//@ Arguments:
|
||||
//@
|
||||
//@ + `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
|
||||
//@ + `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
|
||||
//@
|
||||
//@ Examples:
|
||||
//@
|
||||
//@ ```javascript
|
||||
//@ echo(process.cwd()); // '/usr'
|
||||
//@ pushd('/etc'); // '/etc /usr'
|
||||
//@ echo(process.cwd()); // '/etc'
|
||||
//@ popd(); // '/usr'
|
||||
//@ echo(process.cwd()); // '/usr'
|
||||
//@ ```
|
||||
//@
|
||||
//@ When no arguments are given, `popd` removes the top directory from the stack and performs a `cd` to the new top directory. The elements are numbered from 0, starting at the first directory listed with dirs (i.e., `popd` is equivalent to `popd +0`). Returns an array of paths in the stack.
|
||||
function _popd(options, index) {
|
||||
if (_isStackIndex(options)) {
|
||||
index = options;
|
||||
options = '';
|
||||
}
|
||||
|
||||
options = common.parseOptions(options, {
|
||||
'n': 'no-cd',
|
||||
'q': 'quiet',
|
||||
});
|
||||
|
||||
if (!_dirStack.length) {
|
||||
return common.error('directory stack empty');
|
||||
}
|
||||
|
||||
index = _parseStackIndex(index || '+0');
|
||||
|
||||
if (options['no-cd'] || index > 0 || _dirStack.length + index === 0) {
|
||||
index = index > 0 ? index - 1 : index;
|
||||
_dirStack.splice(index, 1);
|
||||
} else {
|
||||
var dir = path.resolve(_dirStack.shift());
|
||||
_cd('', dir);
|
||||
}
|
||||
|
||||
return _dirs(options.quiet ? '-q' : '');
|
||||
}
|
||||
exports.popd = _popd;
|
||||
|
||||
//@
|
||||
//@
|
||||
//@ ### dirs([options | '+N' | '-N'])
|
||||
//@
|
||||
//@ Available options:
|
||||
//@
|
||||
//@ + `-c`: Clears the directory stack by deleting all of the elements.
|
||||
//@ + `-q`: Supresses output to the console.
|
||||
//@
|
||||
//@ Arguments:
|
||||
//@
|
||||
//@ + `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
|
||||
//@ + `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
|
||||
//@
|
||||
//@ Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if `+N` or `-N` was specified.
|
||||
//@
|
||||
//@ See also: `pushd`, `popd`
|
||||
function _dirs(options, index) {
|
||||
if (_isStackIndex(options)) {
|
||||
index = options;
|
||||
options = '';
|
||||
}
|
||||
|
||||
options = common.parseOptions(options, {
|
||||
'c': 'clear',
|
||||
'q': 'quiet',
|
||||
});
|
||||
|
||||
if (options.clear) {
|
||||
_dirStack = [];
|
||||
return _dirStack;
|
||||
}
|
||||
|
||||
var stack = _actualDirStack();
|
||||
|
||||
if (index) {
|
||||
index = _parseStackIndex(index);
|
||||
|
||||
if (index < 0) {
|
||||
index = stack.length + index;
|
||||
}
|
||||
|
||||
if (!options.quiet) {
|
||||
common.log(stack[index]);
|
||||
}
|
||||
return stack[index];
|
||||
}
|
||||
|
||||
if (!options.quiet) {
|
||||
common.log(stack.join(' '));
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
exports.dirs = _dirs;
|
||||
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var getIterator = require('es-get-iterator');
|
||||
var $TypeError = TypeError;
|
||||
var iterate = require('iterate-iterator');
|
||||
|
||||
module.exports = function iterateValue(iterable) {
|
||||
var iterator = getIterator(iterable);
|
||||
if (!iterator) {
|
||||
throw new $TypeError('non-iterable value provided');
|
||||
}
|
||||
if (arguments.length > 1) {
|
||||
return iterate(iterator, arguments[1]);
|
||||
}
|
||||
return iterate(iterator);
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('snakeCase', require('../snakeCase'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,16 @@
|
||||
/*! blob-to-buffer. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
||||
|
||||
if (!globalThis.DOMException) {
|
||||
const { MessageChannel } = require('worker_threads'),
|
||||
port = new MessageChannel().port1,
|
||||
ab = new ArrayBuffer()
|
||||
try { port.postMessage(ab, [ab, ab]) }
|
||||
catch (err) {
|
||||
console.log(err.code)
|
||||
err.constructor.name === 'DOMException' && (
|
||||
globalThis.DOMException = err.constructor
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = globalThis.DOMException
|
||||
@@ -0,0 +1,66 @@
|
||||
# iterate-value <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![Build Status][travis-svg]][travis-url]
|
||||
[![dependency status][deps-svg]][deps-url]
|
||||
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
Iterate any iterable JS value. Works robustly in all environments, all versions.
|
||||
|
||||
In modern engines, `[...value]` or `Array.from(value)` or `for (const item of value) { }` are sufficient to iterate an iterable value (an object with a `Symbol.iterator` method). However, older engines:
|
||||
- may lack `Symbol`, array spread, or `for..of` support altogether
|
||||
- may have `Symbol.iterator` but not implement it on everything it should, like arguments objects
|
||||
- may have `Map` and `Set`, but a non-standard name for the iterator-producing method (`.iterator` or `['@@iterator']`, eg) and no syntax to support it
|
||||
- may be old versions of Firefox that produce values until they throw a StopIteration exception, rather than having iteration result objects
|
||||
- may be polyfilled/shimmed/shammed, with `es6-shim` or `core-js` or similar
|
||||
|
||||
This library attempts to provide an abstraction over all that complexity!
|
||||
|
||||
If called with a single value, it will return an array of the yielded values. If also called with a callback function, it will instead call that callback once for each yielded value.
|
||||
|
||||
In node v13+, `exports` is used by the `es-get-iterator` dependency to provide a lean implementation that lacks all the complexity described above, in combination with the `browser` field so that bundlers will pick up the proper implementation.
|
||||
|
||||
If you are targeting browsers that definitely all have Symbol support, then you can configure your bundler to replace `require('has-symbols')()` with a literal `true`, which should allow dead code elimination to reduce the size of the bundled code.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var iterate = require('iterate-value');
|
||||
var assert = require('assert');
|
||||
|
||||
assert.deepEqual(iterate('a 💩'), ['a', ' ', '💩']);
|
||||
assert.deepEqual(iterate([1, 2]), [1, 2]);
|
||||
assert.deepEqual(iterate(new Set([1, 2])), [1, 2]);
|
||||
assert.deepEqual(iterate(new Map([[1, 2], [3, 4]])), [[1, 2], [3, 4]]);
|
||||
|
||||
function assertWithCallback(iterable, expected) {
|
||||
var values = [];
|
||||
var callback = function (x) { values.push(x); };
|
||||
iterate(iterable, callback);
|
||||
assert.deepEqual(values, expected);
|
||||
}
|
||||
assertWithCallback('a 💩', ['a', ' ', '💩']);
|
||||
assertWithCallback([1, 2], [1, 2]);
|
||||
assertWithCallback(new Set([1, 2]), [1, 2]);
|
||||
assertWithCallback(new Map([[1, 2], [3, 4]]), [[1, 2], [3, 4]]);
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/iterate-value
|
||||
[npm-version-svg]: http://versionbadg.es/ljharb/iterate-value.svg
|
||||
[travis-svg]: https://travis-ci.org/ljharb/iterate-value.svg
|
||||
[travis-url]: https://travis-ci.org/ljharb/iterate-value
|
||||
[deps-svg]: https://david-dm.org/ljharb/iterate-value.svg
|
||||
[deps-url]: https://david-dm.org/ljharb/iterate-value
|
||||
[dev-deps-svg]: https://david-dm.org/ljharb/iterate-value/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/ljharb/iterate-value#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/iterate-value.png?downloads=true&stars=true
|
||||
[license-image]: http://img.shields.io/npm/l/iterate-value.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: http://img.shields.io/npm/dm/iterate-value.svg
|
||||
[downloads-url]: http://npm-stat.com/charts.html?package=iterate-value
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('forEachRight', require('../forEachRight'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"lift.js","sourceRoot":"","sources":["../../../../src/internal/util/lift.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,MAAM,UAAU,OAAO,CAAC,MAAW;IACjC,OAAO,UAAU,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AAMD,MAAM,UAAU,OAAO,CACrB,IAAqF;IAErF,OAAO,UAAC,MAAqB;QAC3B,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;YACnB,OAAO,MAAM,CAAC,IAAI,CAAC,UAA+B,YAA2B;gBAC3E,IAAI;oBACF,OAAO,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;iBACjC;gBAAC,OAAO,GAAG,EAAE;oBACZ,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;iBACjB;YACH,CAAC,CAAC,CAAC;SACJ;QACD,MAAM,IAAI,SAAS,CAAC,wCAAwC,CAAC,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"onetime","version":"6.0.0","files":{"license":{"checkedAt":1678883669302,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"package.json":{"checkedAt":1678883670752,"integrity":"sha512-f5sNlbK2TqF4w1LXaFGaiNXg3pgDNWkA+t3ljclY607EOrbV2aH0dQvwufjjJNkyBWFgATPnRkeRK4Ta1mH5iA==","mode":420,"size":763},"index.js":{"checkedAt":1678883670752,"integrity":"sha512-rik+e9pGPWN3bbdq8GfiIl6VGwT0AVB0crn4aA6nGTO1rlebTpuaUEVuXd1oSdIjZKJk4PWpd9udRbckmOCJRA==","mode":420,"size":1022},"readme.md":{"checkedAt":1678883670752,"integrity":"sha512-aKPqm4SGnr1VMWDo25btp+UqY3kAnnU+yiNKIcMwHnw01ST+HRCC84uqHCxlSfMSHOasvldHi8flntIxijmTUw==","mode":420,"size":1824},"index.d.ts":{"checkedAt":1678883670752,"integrity":"sha512-Ey4xSqudEbFvDIQNqAevZD4pogpMc3ZbAfMoWBdfvBewpBKEQ8m79sL7vkDZPBNJiX9To5LmDz8hJSWXNGjc4g==","mode":420,"size":1156}}}
|
||||
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.animationFrames = void 0;
|
||||
var Observable_1 = require("../../Observable");
|
||||
var performanceTimestampProvider_1 = require("../../scheduler/performanceTimestampProvider");
|
||||
var animationFrameProvider_1 = require("../../scheduler/animationFrameProvider");
|
||||
function animationFrames(timestampProvider) {
|
||||
return timestampProvider ? animationFramesFactory(timestampProvider) : DEFAULT_ANIMATION_FRAMES;
|
||||
}
|
||||
exports.animationFrames = animationFrames;
|
||||
function animationFramesFactory(timestampProvider) {
|
||||
return new Observable_1.Observable(function (subscriber) {
|
||||
var provider = timestampProvider || performanceTimestampProvider_1.performanceTimestampProvider;
|
||||
var start = provider.now();
|
||||
var id = 0;
|
||||
var run = function () {
|
||||
if (!subscriber.closed) {
|
||||
id = animationFrameProvider_1.animationFrameProvider.requestAnimationFrame(function (timestamp) {
|
||||
id = 0;
|
||||
var now = provider.now();
|
||||
subscriber.next({
|
||||
timestamp: timestampProvider ? now : timestamp,
|
||||
elapsed: now - start,
|
||||
});
|
||||
run();
|
||||
});
|
||||
}
|
||||
};
|
||||
run();
|
||||
return function () {
|
||||
if (id) {
|
||||
animationFrameProvider_1.animationFrameProvider.cancelAnimationFrame(id);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
var DEFAULT_ANIMATION_FRAMES = animationFramesFactory();
|
||||
//# sourceMappingURL=animationFrames.js.map
|
||||
@@ -0,0 +1,302 @@
|
||||
let featureQueries = require('caniuse-lite/data/features/css-featurequeries.js')
|
||||
let feature = require('caniuse-lite/dist/unpacker/feature')
|
||||
let { parse } = require('postcss')
|
||||
|
||||
let Browsers = require('./browsers')
|
||||
let brackets = require('./brackets')
|
||||
let Value = require('./value')
|
||||
let utils = require('./utils')
|
||||
|
||||
let data = feature(featureQueries)
|
||||
|
||||
let supported = []
|
||||
for (let browser in data.stats) {
|
||||
let versions = data.stats[browser]
|
||||
for (let version in versions) {
|
||||
let support = versions[version]
|
||||
if (/y/.test(support)) {
|
||||
supported.push(browser + ' ' + version)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Supports {
|
||||
constructor(Prefixes, all) {
|
||||
this.Prefixes = Prefixes
|
||||
this.all = all
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixer only with @supports supported browsers
|
||||
*/
|
||||
prefixer() {
|
||||
if (this.prefixerCache) {
|
||||
return this.prefixerCache
|
||||
}
|
||||
|
||||
let filtered = this.all.browsers.selected.filter(i => {
|
||||
return supported.includes(i)
|
||||
})
|
||||
|
||||
let browsers = new Browsers(
|
||||
this.all.browsers.data,
|
||||
filtered,
|
||||
this.all.options
|
||||
)
|
||||
this.prefixerCache = new this.Prefixes(
|
||||
this.all.data,
|
||||
browsers,
|
||||
this.all.options
|
||||
)
|
||||
return this.prefixerCache
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse string into declaration property and value
|
||||
*/
|
||||
parse(str) {
|
||||
let parts = str.split(':')
|
||||
let prop = parts[0]
|
||||
let value = parts[1]
|
||||
if (!value) value = ''
|
||||
return [prop.trim(), value.trim()]
|
||||
}
|
||||
|
||||
/**
|
||||
* Create virtual rule to process it by prefixer
|
||||
*/
|
||||
virtual(str) {
|
||||
let [prop, value] = this.parse(str)
|
||||
let rule = parse('a{}').first
|
||||
rule.append({ prop, value, raws: { before: '' } })
|
||||
return rule
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of Declaration with all necessary prefixes
|
||||
*/
|
||||
prefixed(str) {
|
||||
let rule = this.virtual(str)
|
||||
if (this.disabled(rule.first)) {
|
||||
return rule.nodes
|
||||
}
|
||||
|
||||
let result = { warn: () => null }
|
||||
|
||||
let prefixer = this.prefixer().add[rule.first.prop]
|
||||
prefixer && prefixer.process && prefixer.process(rule.first, result)
|
||||
|
||||
for (let decl of rule.nodes) {
|
||||
for (let value of this.prefixer().values('add', rule.first.prop)) {
|
||||
value.process(decl)
|
||||
}
|
||||
Value.save(this.all, decl)
|
||||
}
|
||||
|
||||
return rule.nodes
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if brackets node is "not" word
|
||||
*/
|
||||
isNot(node) {
|
||||
return typeof node === 'string' && /not\s*/i.test(node)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if brackets node is "or" word
|
||||
*/
|
||||
isOr(node) {
|
||||
return typeof node === 'string' && /\s*or\s*/i.test(node)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if brackets node is (prop: value)
|
||||
*/
|
||||
isProp(node) {
|
||||
return (
|
||||
typeof node === 'object' &&
|
||||
node.length === 1 &&
|
||||
typeof node[0] === 'string'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if prefixed property has no unprefixed
|
||||
*/
|
||||
isHack(all, unprefixed) {
|
||||
let check = new RegExp(`(\\(|\\s)${utils.escapeRegexp(unprefixed)}:`)
|
||||
return !check.test(all)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if we need to remove node
|
||||
*/
|
||||
toRemove(str, all) {
|
||||
let [prop, value] = this.parse(str)
|
||||
let unprefixed = this.all.unprefixed(prop)
|
||||
|
||||
let cleaner = this.all.cleaner()
|
||||
|
||||
if (
|
||||
cleaner.remove[prop] &&
|
||||
cleaner.remove[prop].remove &&
|
||||
!this.isHack(all, unprefixed)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
for (let checker of cleaner.values('remove', unprefixed)) {
|
||||
if (checker.check(value)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all unnecessary prefixes
|
||||
*/
|
||||
remove(nodes, all) {
|
||||
let i = 0
|
||||
while (i < nodes.length) {
|
||||
if (
|
||||
!this.isNot(nodes[i - 1]) &&
|
||||
this.isProp(nodes[i]) &&
|
||||
this.isOr(nodes[i + 1])
|
||||
) {
|
||||
if (this.toRemove(nodes[i][0], all)) {
|
||||
nodes.splice(i, 2)
|
||||
continue
|
||||
}
|
||||
|
||||
i += 2
|
||||
continue
|
||||
}
|
||||
|
||||
if (typeof nodes[i] === 'object') {
|
||||
nodes[i] = this.remove(nodes[i], all)
|
||||
}
|
||||
|
||||
i += 1
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean brackets with one child
|
||||
*/
|
||||
cleanBrackets(nodes) {
|
||||
return nodes.map(i => {
|
||||
if (typeof i !== 'object') {
|
||||
return i
|
||||
}
|
||||
|
||||
if (i.length === 1 && typeof i[0] === 'object') {
|
||||
return this.cleanBrackets(i[0])
|
||||
}
|
||||
|
||||
return this.cleanBrackets(i)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Add " or " between properties and convert it to brackets format
|
||||
*/
|
||||
convert(progress) {
|
||||
let result = ['']
|
||||
for (let i of progress) {
|
||||
result.push([`${i.prop}: ${i.value}`])
|
||||
result.push(' or ')
|
||||
}
|
||||
result[result.length - 1] = ''
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Compress value functions into a string nodes
|
||||
*/
|
||||
normalize(nodes) {
|
||||
if (typeof nodes !== 'object') {
|
||||
return nodes
|
||||
}
|
||||
|
||||
nodes = nodes.filter(i => i !== '')
|
||||
|
||||
if (typeof nodes[0] === 'string') {
|
||||
let firstNode = nodes[0].trim()
|
||||
|
||||
if (
|
||||
firstNode.includes(':') ||
|
||||
firstNode === 'selector' ||
|
||||
firstNode === 'not selector'
|
||||
) {
|
||||
return [brackets.stringify(nodes)]
|
||||
}
|
||||
}
|
||||
return nodes.map(i => this.normalize(i))
|
||||
}
|
||||
|
||||
/**
|
||||
* Add prefixes
|
||||
*/
|
||||
add(nodes, all) {
|
||||
return nodes.map(i => {
|
||||
if (this.isProp(i)) {
|
||||
let prefixed = this.prefixed(i[0])
|
||||
if (prefixed.length > 1) {
|
||||
return this.convert(prefixed)
|
||||
}
|
||||
|
||||
return i
|
||||
}
|
||||
|
||||
if (typeof i === 'object') {
|
||||
return this.add(i, all)
|
||||
}
|
||||
|
||||
return i
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Add prefixed declaration
|
||||
*/
|
||||
process(rule) {
|
||||
let ast = brackets.parse(rule.params)
|
||||
ast = this.normalize(ast)
|
||||
ast = this.remove(ast, rule.params)
|
||||
ast = this.add(ast, rule.params)
|
||||
ast = this.cleanBrackets(ast)
|
||||
rule.params = brackets.stringify(ast)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check global options
|
||||
*/
|
||||
disabled(node) {
|
||||
if (!this.all.options.grid) {
|
||||
if (node.prop === 'display' && node.value.includes('grid')) {
|
||||
return true
|
||||
}
|
||||
if (node.prop.includes('grid') || node.prop === 'justify-items') {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if (this.all.options.flexbox === false) {
|
||||
if (node.prop === 'display' && node.value.includes('flex')) {
|
||||
return true
|
||||
}
|
||||
let other = ['order', 'justify-content', 'align-items', 'align-content']
|
||||
if (node.prop.includes('flex') || other.includes(node.prop)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Supports
|
||||
@@ -0,0 +1,16 @@
|
||||
var createBaseFor = require('./_createBaseFor');
|
||||
|
||||
/**
|
||||
* The base implementation of `baseForOwn` which iterates over `object`
|
||||
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
||||
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @param {Function} keysFunc The function to get the keys of `object`.
|
||||
* @returns {Object} Returns `object`.
|
||||
*/
|
||||
var baseFor = createBaseFor();
|
||||
|
||||
module.exports = baseFor;
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
Colored symbols for various log levels.
|
||||
|
||||
Includes fallbacks for Windows CMD which only supports a [limited character set](https://en.wikipedia.org/wiki/Code_page_437).
|
||||
|
||||
@example
|
||||
```
|
||||
import logSymbols from 'log-symbols';
|
||||
|
||||
console.log(logSymbols.success, 'Finished successfully!');
|
||||
// Terminals with Unicode support: ✔ Finished successfully!
|
||||
// Terminals without Unicode support: √ Finished successfully!
|
||||
```
|
||||
*/
|
||||
declare const logSymbols: {
|
||||
readonly info: string;
|
||||
readonly success: string;
|
||||
readonly warning: string;
|
||||
readonly error: string;
|
||||
};
|
||||
|
||||
export default logSymbols;
|
||||
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* `editor` type prompt
|
||||
*/
|
||||
|
||||
import chalk from 'chalk';
|
||||
import { editAsync } from 'external-editor';
|
||||
import Base from './base.js';
|
||||
import observe from '../utils/events.js';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
export default class EditorPrompt extends Base {
|
||||
/**
|
||||
* Start the Inquiry session
|
||||
* @param {Function} cb Callback when prompt is done
|
||||
* @return {this}
|
||||
*/
|
||||
|
||||
_run(cb) {
|
||||
this.done = cb;
|
||||
|
||||
this.editorResult = new Subject();
|
||||
|
||||
// Open Editor on "line" (Enter Key)
|
||||
const events = observe(this.rl);
|
||||
this.lineSubscription = events.line.subscribe(this.startExternalEditor.bind(this));
|
||||
const waitUserInput =
|
||||
this.opt.waitUserInput === undefined ? true : this.opt.waitUserInput;
|
||||
|
||||
if (!waitUserInput) {
|
||||
this.startExternalEditor();
|
||||
}
|
||||
|
||||
// Trigger Validation when editor closes
|
||||
const validation = this.handleSubmitEvents(this.editorResult);
|
||||
validation.success.forEach(this.onEnd.bind(this));
|
||||
validation.error.forEach(this.onError.bind(this));
|
||||
|
||||
// Prevents default from being printed on screen (can look weird with multiple lines)
|
||||
this.currentText = this.opt.default;
|
||||
this.opt.default = null;
|
||||
|
||||
// Init
|
||||
this.render();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the prompt to screen
|
||||
* @return {EditorPrompt} self
|
||||
*/
|
||||
|
||||
render(error) {
|
||||
let bottomContent = '';
|
||||
let message = this.getQuestion();
|
||||
|
||||
if (this.status === 'answered') {
|
||||
message += chalk.dim('Received');
|
||||
} else {
|
||||
message += chalk.dim('Press <enter> to launch your preferred editor.');
|
||||
}
|
||||
|
||||
if (error) {
|
||||
bottomContent = chalk.red('>> ') + error;
|
||||
}
|
||||
|
||||
this.screen.render(message, bottomContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Launch $EDITOR on user press enter
|
||||
*/
|
||||
|
||||
startExternalEditor() {
|
||||
// Pause Readline to prevent stdin and stdout from being modified while the editor is showing
|
||||
this.rl.pause();
|
||||
editAsync(this.currentText, this.endExternalEditor.bind(this));
|
||||
}
|
||||
|
||||
endExternalEditor(error, result) {
|
||||
this.rl.resume();
|
||||
if (error) {
|
||||
this.editorResult.error(error);
|
||||
} else {
|
||||
this.editorResult.next(result);
|
||||
}
|
||||
}
|
||||
|
||||
onEnd(state) {
|
||||
this.editorResult.unsubscribe();
|
||||
this.lineSubscription.unsubscribe();
|
||||
this.answer = state.value;
|
||||
this.status = 'answered';
|
||||
// Re-render prompt
|
||||
this.render();
|
||||
this.screen.done();
|
||||
this.done(this.answer);
|
||||
}
|
||||
|
||||
onError(state) {
|
||||
this.render(state.isValid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var every = require('./every');
|
||||
|
||||
module.exports = function isSamePropertyDescriptor(ES, D1, D2) {
|
||||
var fields = [
|
||||
'[[Configurable]]',
|
||||
'[[Enumerable]]',
|
||||
'[[Get]]',
|
||||
'[[Set]]',
|
||||
'[[Value]]',
|
||||
'[[Writable]]'
|
||||
];
|
||||
return every(fields, function (field) {
|
||||
if ((field in D1) !== (field in D2)) {
|
||||
return false;
|
||||
}
|
||||
return ES.SameValue(D1[field], D2[field]);
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"isScheduler.js","sourceRoot":"","sources":["../../../../src/internal/util/isScheduler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,UAAU,WAAW,CAAC,KAAU;IACpC,OAAO,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC7C,CAAC"}
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
|
||||
col1, col2.0, col2.1,col4.col3,col4.col5
|
||||
d1,,d3,,world
|
||||
|
||||
d2,d,d,d,d
|
||||
,,,,
|
||||
d4,d2,d3
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"27":0.00394,"52":0.03939,"54":0.02757,"68":0.00394,"73":0.00788,"78":0.01182,"80":0.00394,"81":0.00394,"86":0.00394,"87":0.00394,"88":0.01182,"91":0.03151,"96":0.00394,"97":0.00394,"99":0.00788,"102":0.04333,"103":0.00788,"104":0.0197,"105":0.01182,"106":0.0197,"107":0.0197,"108":0.04333,"109":0.83901,"110":0.54752,"111":0.00394,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 55 56 57 58 59 60 61 62 63 64 65 66 67 69 70 71 72 74 75 76 77 79 82 83 84 85 89 90 92 93 94 95 98 100 101 112 3.5 3.6"},D:{"38":0.01576,"47":0.00788,"49":0.06696,"51":0.00394,"53":0.00394,"55":0.00394,"58":0.00394,"63":0.00394,"65":0.00788,"66":0.01182,"67":0.00394,"68":0.01182,"69":0.00394,"70":0.00788,"71":0.00394,"72":0.00788,"73":0.00394,"74":0.01182,"75":0.01182,"76":0.01182,"77":0.00788,"78":0.01182,"79":0.12605,"80":0.01576,"81":0.02757,"83":0.02363,"84":0.03151,"85":0.05121,"86":0.04727,"87":0.06302,"88":0.01576,"89":0.0197,"90":0.04727,"91":0.32694,"92":0.04727,"93":0.04727,"94":0.04727,"95":0.01576,"96":0.03545,"97":0.03151,"98":0.02757,"99":0.03151,"100":0.04333,"101":0.03151,"102":0.03545,"103":0.12211,"104":0.06302,"105":0.08666,"106":0.07878,"107":0.14574,"108":0.52783,"109":15.96477,"110":9.83962,"111":0.01576,"112":0.00788,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 39 40 41 42 43 44 45 46 48 50 52 54 56 57 59 60 61 62 64 113"},F:{"28":0.00788,"36":0.00394,"79":0.00788,"85":0.00788,"93":0.31118,"94":2.45006,"95":0.71296,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 86 87 88 89 90 91 92 9.5-9.6 10.5 10.6 11.1 11.5 11.6 12.1","10.0-10.1":0},B:{"12":0.00394,"15":0.03151,"18":0.00788,"84":0.00394,"92":0.01182,"105":0.00394,"106":0.00394,"107":0.04727,"108":0.03545,"109":1.15019,"110":1.57954,_:"13 14 16 17 79 80 81 83 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104"},E:{"4":0,"14":0.0197,"15":0.00788,_:"0 5 6 7 8 9 10 11 12 13 3.1 3.2 5.1 6.1 7.1 10.1 11.1 16.4","9.1":0.02363,"12.1":0.00394,"13.1":0.03151,"14.1":0.05121,"15.1":0.00788,"15.2-15.3":0.00788,"15.4":0.01576,"15.5":0.03545,"15.6":0.1418,"16.0":0.02363,"16.1":0.07484,"16.2":0.14968,"16.3":0.12999},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.00477,"6.0-6.1":0.0008,"7.0-7.1":0.00318,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.02385,"10.0-10.2":0,"10.3":0.02385,"11.0-11.2":0.00795,"11.3-11.4":0.02067,"12.0-12.1":0.00795,"12.2-12.5":0.15426,"13.0-13.1":0.00398,"13.2":0.00318,"13.3":0.01034,"13.4-13.7":0.03737,"14.0-14.4":0.07872,"14.5-14.8":0.20674,"15.0-15.1":0.03817,"15.2-15.3":0.05884,"15.4":0.07713,"15.5":0.17095,"15.6":0.63134,"16.0":0.84523,"16.1":1.85426,"16.2":1.89163,"16.3":1.08218,"16.4":0.00557},P:{"4":0.16297,"20":0.68243,"5.0-5.4":0.03188,"6.2-6.4":0.08151,"7.2-7.4":0.18334,"8.2":0.01016,"9.2":0.03097,"10.1":0.01011,"11.1-11.2":0.03056,"12.0":0.02065,"13.0":0.03056,"14.0":0.03056,"15.0":0.02037,"16.0":0.05093,"17.0":0.11204,"18.0":0.0713,"19.0":1.07966},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00242,"4.2-4.3":0.00606,"4.4":0,"4.4.3-4.4.4":0.03394},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"8":0.00846,"9":0.00846,"11":0.09731,_:"6 7 10 5.5"},N:{"10":0.03712,"11":0.07423},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.04849},H:{"0":0.1951},L:{"0":51.63368},R:{_:"0"},M:{"0":0.14546},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Subscriber } from '../Subscriber';
|
||||
|
||||
/**
|
||||
* Subscribes to an ArrayLike with a subscriber
|
||||
* @param array The array or array-like to subscribe to
|
||||
*/
|
||||
export const subscribeToArray = <T>(array: ArrayLike<T>) => (subscriber: Subscriber<T>) => {
|
||||
for (let i = 0, len = array.length; i < len && !subscriber.closed; i++) {
|
||||
subscriber.next(array[i]);
|
||||
}
|
||||
subscriber.complete();
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
import type {BuiltIns} from './internal';
|
||||
import type {Merge} from './merge';
|
||||
|
||||
/**
|
||||
@see PartialOnUndefinedDeep
|
||||
*/
|
||||
export type PartialOnUndefinedDeepOptions = {
|
||||
/**
|
||||
Whether to affect the individual elements of arrays and tuples.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly recurseIntoArrays?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
Create a deep version of another type where all keys accepting `undefined` type are set to optional.
|
||||
|
||||
This utility type is recursive, transforming at any level deep. By default, it does not affect arrays and tuples items unless you explicitly pass `{recurseIntoArrays: true}` as the second type argument.
|
||||
|
||||
Use-cases:
|
||||
- Make all properties of a type that can be undefined optional to not have to specify keys with undefined value.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {PartialOnUndefinedDeep} from 'type-fest';
|
||||
|
||||
interface Settings {
|
||||
optionA: string;
|
||||
optionB: number | undefined;
|
||||
subOption: {
|
||||
subOptionA: boolean;
|
||||
subOptionB: boolean | undefined;
|
||||
}
|
||||
};
|
||||
|
||||
const testSettings: PartialOnUndefinedDeep<Settings> = {
|
||||
optionA: 'foo',
|
||||
// 👉 optionB is now optional and can be omitted
|
||||
subOption: {
|
||||
subOptionA: true,
|
||||
// 👉 subOptionB is now optional as well and can be omitted
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
@category Object
|
||||
*/
|
||||
export type PartialOnUndefinedDeep<T, Options extends PartialOnUndefinedDeepOptions = {}> = T extends Record<any, any> | undefined
|
||||
? {[KeyType in keyof T as undefined extends T[KeyType] ? KeyType : never]?: PartialOnUndefinedDeepValue<T[KeyType], Options>} extends infer U // Make a partial type with all value types accepting undefined (and set them optional)
|
||||
? Merge<{[KeyType in keyof T as KeyType extends keyof U ? never : KeyType]: PartialOnUndefinedDeepValue<T[KeyType], Options>}, U> // Join all remaining keys not treated in U
|
||||
: never // Should not happen
|
||||
: T;
|
||||
|
||||
/**
|
||||
Utility type to get the value type by key and recursively call `PartialOnUndefinedDeep` to transform sub-objects.
|
||||
*/
|
||||
type PartialOnUndefinedDeepValue<T, Options extends PartialOnUndefinedDeepOptions> = T extends BuiltIns | ((...arguments: any[]) => unknown)
|
||||
? T
|
||||
: T extends ReadonlyArray<infer U> // Test if type is array or tuple
|
||||
? Options['recurseIntoArrays'] extends true // Check if option is activated
|
||||
? U[] extends T // Check if array not tuple
|
||||
? readonly U[] extends T
|
||||
? ReadonlyArray<PartialOnUndefinedDeep<U, Options>> // Readonly array treatment
|
||||
: Array<PartialOnUndefinedDeep<U, Options>> // Mutable array treatment
|
||||
: PartialOnUndefinedDeep<{[Key in keyof T]: PartialOnUndefinedDeep<T[Key], Options>}, Options> // Tuple treatment
|
||||
: T
|
||||
: T extends Record<any, any> | undefined
|
||||
? PartialOnUndefinedDeep<T, Options>
|
||||
: unknown;
|
||||
@@ -0,0 +1,5 @@
|
||||
import { filter } from './filter';
|
||||
export function skip(count) {
|
||||
return filter((_, index) => count <= index);
|
||||
}
|
||||
//# sourceMappingURL=skip.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,kDAAgC;AAEhC,6BAAgD;AAEhD,qBAAqB;AACrB,kDAA0B;AAC1B,kDAA0B;AAC1B,gDAAwB;AACxB,kDAA0B;AAC1B,oDAA4B;AAE5B,MAAM,KAAK,GAAG,eAAW,CAAC,SAAS,CAAC,CAAC;AAyBrC,SAAS,MAAM,CACd,GAAW,EACX,IAAmD,EACnD,EAA0B;IAE1B,MAAM,CAAC,GAAG,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnD,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAEzB,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;YAC/B,EAAE,GAAG,IAAI,CAAC;YACV,IAAI,GAAG,SAAS,CAAC;SACjB;QAED,IAAI,CAAC,GAAG,EAAE;YACT,MAAM,CAAC,IAAI,SAAS,CAAC,6BAA6B,CAAC,CAAC,CAAC;YACrD,OAAO;SACP;QAED,MAAM,MAAM,GAAG,WAAK,CAAC,GAAG,CAAC,CAAC;QAE1B,qBAAqB;QACrB,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,EAAE;YACd,MAAM,CAAC,IAAI,SAAS,CAAC,oCAAoC,GAAG,EAAE,CAAC,CAAC,CAAC;YACjE,OAAO;SACP;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE1C,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;YACjC,MAAM,IAAI,SAAS,CAClB,yBAAyB,QAAQ,uBAAuB,GAAG,EAAE,CAC7D,CAAC;SACF;QAED,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE;QAC7B,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAG,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,EAAG,CAAC,GAAG,CAAC,CAAC,CAAC;KAC/C;SAAM;QACN,OAAO,CAAC,CAAC;KACT;AACF,CAAC;AAED,WAAU,MAAM;IASF,gBAAS,GAA6C;QAClE,IAAI,EAAJ,cAAI;QACJ,IAAI,EAAJ,cAAI;QACJ,GAAG,EAAH,aAAG;QACH,IAAI,EAAJ,cAAI;QACJ,KAAK,EAAL,eAAK;KACL,CAAC;AACH,CAAC,EAhBS,MAAM,KAAN,MAAM,QAgBf;AAED,iBAAS,MAAM,CAAC"}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,399 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/src/rowSplit.test.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../../prettify.css" />
|
||||
<link rel="stylesheet" href="../../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../../index.html">All files</a> / <a href="index.html">csv2json/src</a> rowSplit.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>31/31</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>31/31</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<a name='L93'></a><a href='#L93'>93</a>
|
||||
<a name='L94'></a><a href='#L94'>94</a>
|
||||
<a name='L95'></a><a href='#L95'>95</a>
|
||||
<a name='L96'></a><a href='#L96'>96</a>
|
||||
<a name='L97'></a><a href='#L97'>97</a>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { RowSplit, MultipleRowResult, RowSplitResult } from "./rowSplit";
|
||||
import { Converter } from "./Converter";
|
||||
const assert = require("assert");
|
||||
|
||||
describe("Test delimiters", function () {
|
||||
const getDelimiter = (str, opt: { delimiter: string | string[] }): string => {
|
||||
return RowSplit.prototype["getDelimiter"].call({
|
||||
conv: {
|
||||
parseParam: {
|
||||
delimiter: opt.delimiter
|
||||
}
|
||||
}
|
||||
}, str);
|
||||
}
|
||||
|
||||
it("should return the explicitly specified delimiter", function () {
|
||||
var delimiter = ";";
|
||||
var rowStr = "a;b;c";
|
||||
var returnedDelimiter = getDelimiter(rowStr, { delimiter: ";" });
|
||||
assert.equal(returnedDelimiter, delimiter);
|
||||
});
|
||||
|
||||
it("should return the autodetected delimiter if 'auto' specified", function () {
|
||||
var rowStr = "a;b;c";
|
||||
var returnedDelimiter = getDelimiter(rowStr, { delimiter: "auto" });
|
||||
assert(returnedDelimiter === ";");
|
||||
});
|
||||
|
||||
it("should return the ',' delimiter if delimiter cannot be specified, in case of 'auto'", function () {
|
||||
var rowStr = "abc";
|
||||
var returnedDelimiter = getDelimiter(rowStr, { delimiter: "auto" });
|
||||
assert(returnedDelimiter === ",");
|
||||
});
|
||||
|
||||
it("should accetp an array with potential delimiters", function () {
|
||||
var rowStr = "a$b$c";
|
||||
var returnedDelimiter = getDelimiter(rowStr, { delimiter: [",", ";", "$"] });
|
||||
assert(returnedDelimiter === '$');
|
||||
});
|
||||
});
|
||||
|
||||
describe("ParseMultiLine function", function () {
|
||||
const rowSplit = new RowSplit(new Converter());
|
||||
const func = (lines: string[]): MultipleRowResult => {
|
||||
return rowSplit.parseMultiLines(lines);
|
||||
}
|
||||
it("should convert lines to csv lines", function () {
|
||||
var lines = [
|
||||
"a,b,c,d",
|
||||
"hello,world,csvtojson,abc",
|
||||
"1,2,3,4"
|
||||
];
|
||||
var res = func(lines);
|
||||
assert.equal(res.rowsCells.length, 3);
|
||||
assert.equal(res.partial, "");
|
||||
});
|
||||
|
||||
it("should process line breaks", function () {
|
||||
var lines = [
|
||||
"a,b,c",
|
||||
'15",hello,"ab',
|
||||
"cde\"",
|
||||
"\"b\"\"b\",cc,dd"
|
||||
];
|
||||
var res = func(lines);
|
||||
assert.equal(res.rowsCells.length, 3);
|
||||
assert.equal(res.rowsCells[1][0], "15\"");
|
||||
assert.equal(res.rowsCells[1][2], "ab\ncde");
|
||||
assert.equal(res.rowsCells[2][0], "b\"b");
|
||||
assert.equal(res.partial, "");
|
||||
});
|
||||
|
||||
it("should return partial if line not closed", function () {
|
||||
var lines = [
|
||||
"a,b,c",
|
||||
'15",hello,"ab',
|
||||
"d,e,f"
|
||||
];
|
||||
var res = func(lines);
|
||||
assert.equal(res.rowsCells.length, 1);
|
||||
assert.equal(res.partial, "15\",hello,\"ab\nd,e,f\n");
|
||||
});
|
||||
});
|
||||
|
||||
describe("RowSplit.parse function", function () {
|
||||
const rowSplit = new RowSplit(new Converter());
|
||||
const func = (str): RowSplitResult => {
|
||||
return rowSplit.parse(str);
|
||||
}
|
||||
it("should split complete csv line", function () {
|
||||
var str = "hello,world,csvtojson,awesome";
|
||||
var res = func(str);
|
||||
assert.equal(res.cells.length, 4);
|
||||
assert.equal(res.closed, true);
|
||||
});
|
||||
|
||||
it("should split incomplete csv line", function () {
|
||||
var str = "hello,world,\"csvtojson,awesome";
|
||||
var res = func(str);
|
||||
assert.equal(res.closed, false);
|
||||
});
|
||||
|
||||
it("should allow multiple line", function () {
|
||||
var str = "\"he\"llo\",world,\"csvtojson,a\"\nwesome\"";
|
||||
var res = func(str);
|
||||
assert.equal(res.closed, true);
|
||||
assert.equal(res.cells[2], 'csvtojson,a"\nwesome');
|
||||
});
|
||||
|
||||
});
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:20:20 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../../sorter.js"></script>
|
||||
<script src="../../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,138 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var universalUserAgent = require('universal-user-agent');
|
||||
var beforeAfterHook = require('before-after-hook');
|
||||
var request = require('@octokit/request');
|
||||
var graphql = require('@octokit/graphql');
|
||||
var authToken = require('@octokit/auth-token');
|
||||
|
||||
const VERSION = "4.2.0";
|
||||
|
||||
class Octokit {
|
||||
constructor(options = {}) {
|
||||
const hook = new beforeAfterHook.Collection();
|
||||
const requestDefaults = {
|
||||
baseUrl: request.request.endpoint.DEFAULTS.baseUrl,
|
||||
headers: {},
|
||||
request: Object.assign({}, options.request, {
|
||||
// @ts-ignore internal usage only, no need to type
|
||||
hook: hook.bind(null, "request")
|
||||
}),
|
||||
mediaType: {
|
||||
previews: [],
|
||||
format: ""
|
||||
}
|
||||
}; // prepend default user agent with `options.userAgent` if set
|
||||
|
||||
requestDefaults.headers["user-agent"] = [options.userAgent, `octokit-core.js/${VERSION} ${universalUserAgent.getUserAgent()}`].filter(Boolean).join(" ");
|
||||
|
||||
if (options.baseUrl) {
|
||||
requestDefaults.baseUrl = options.baseUrl;
|
||||
}
|
||||
|
||||
if (options.previews) {
|
||||
requestDefaults.mediaType.previews = options.previews;
|
||||
}
|
||||
|
||||
if (options.timeZone) {
|
||||
requestDefaults.headers["time-zone"] = options.timeZone;
|
||||
}
|
||||
|
||||
this.request = request.request.defaults(requestDefaults);
|
||||
this.graphql = graphql.withCustomRequest(this.request).defaults(requestDefaults);
|
||||
this.log = Object.assign({
|
||||
debug: () => {},
|
||||
info: () => {},
|
||||
warn: console.warn.bind(console),
|
||||
error: console.error.bind(console)
|
||||
}, options.log);
|
||||
this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance
|
||||
// is unauthenticated. The `this.auth()` method is a no-op and no request hook is registered.
|
||||
// (2) If only `options.auth` is set, use the default token authentication strategy.
|
||||
// (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance.
|
||||
// TODO: type `options.auth` based on `options.authStrategy`.
|
||||
|
||||
if (!options.authStrategy) {
|
||||
if (!options.auth) {
|
||||
// (1)
|
||||
this.auth = async () => ({
|
||||
type: "unauthenticated"
|
||||
});
|
||||
} else {
|
||||
// (2)
|
||||
const auth = authToken.createTokenAuth(options.auth); // @ts-ignore ¯\_(ツ)_/¯
|
||||
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
}
|
||||
} else {
|
||||
const {
|
||||
authStrategy,
|
||||
...otherOptions
|
||||
} = options;
|
||||
const auth = authStrategy(Object.assign({
|
||||
request: this.request,
|
||||
log: this.log,
|
||||
// we pass the current octokit instance as well as its constructor options
|
||||
// to allow for authentication strategies that return a new octokit instance
|
||||
// that shares the same internal state as the current one. The original
|
||||
// requirement for this was the "event-octokit" authentication strategy
|
||||
// of https://github.com/probot/octokit-auth-probot.
|
||||
octokit: this,
|
||||
octokitOptions: otherOptions
|
||||
}, options.auth)); // @ts-ignore ¯\_(ツ)_/¯
|
||||
|
||||
hook.wrap("request", auth.hook);
|
||||
this.auth = auth;
|
||||
} // apply plugins
|
||||
// https://stackoverflow.com/a/16345172
|
||||
|
||||
|
||||
const classConstructor = this.constructor;
|
||||
classConstructor.plugins.forEach(plugin => {
|
||||
Object.assign(this, plugin(this, options));
|
||||
});
|
||||
}
|
||||
|
||||
static defaults(defaults) {
|
||||
const OctokitWithDefaults = class extends this {
|
||||
constructor(...args) {
|
||||
const options = args[0] || {};
|
||||
|
||||
if (typeof defaults === "function") {
|
||||
super(defaults(options));
|
||||
return;
|
||||
}
|
||||
|
||||
super(Object.assign({}, defaults, options, options.userAgent && defaults.userAgent ? {
|
||||
userAgent: `${options.userAgent} ${defaults.userAgent}`
|
||||
} : null));
|
||||
}
|
||||
|
||||
};
|
||||
return OctokitWithDefaults;
|
||||
}
|
||||
/**
|
||||
* Attach a plugin (or many) to your Octokit instance.
|
||||
*
|
||||
* @example
|
||||
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
|
||||
*/
|
||||
|
||||
|
||||
static plugin(...newPlugins) {
|
||||
var _a;
|
||||
|
||||
const currentPlugins = this.plugins;
|
||||
const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);
|
||||
return NewOctokit;
|
||||
}
|
||||
|
||||
}
|
||||
Octokit.VERSION = VERSION;
|
||||
Octokit.plugins = [];
|
||||
|
||||
exports.Octokit = Octokit;
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../../../src/internal/observable/zip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAOhD,wBAAgB,GAAG,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AACxG,wBAAgB,GAAG,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EAAE,CAAC,EACjD,OAAO,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,EACrC,cAAc,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,GAClC,UAAU,CAAC,CAAC,CAAC,CAAC;AACjB,wBAAgB,GAAG,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AAC3G,wBAAgB,GAAG,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EAAE,CAAC,EACjD,GAAG,wBAAwB,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,GAC7E,UAAU,CAAC,CAAC,CAAC,CAAC"}
|
||||
@@ -0,0 +1,171 @@
|
||||
/**
|
||||
* The `trace_events` module provides a mechanism to centralize tracing information
|
||||
* generated by V8, Node.js core, and userspace code.
|
||||
*
|
||||
* Tracing can be enabled with the `--trace-event-categories` command-line flag
|
||||
* or by using the `trace_events` module. The `--trace-event-categories` flag
|
||||
* accepts a list of comma-separated category names.
|
||||
*
|
||||
* The available categories are:
|
||||
*
|
||||
* * `node`: An empty placeholder.
|
||||
* * `node.async_hooks`: Enables capture of detailed `async_hooks` trace data.
|
||||
* The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
|
||||
* * `node.bootstrap`: Enables capture of Node.js bootstrap milestones.
|
||||
* * `node.console`: Enables capture of `console.time()` and `console.count()`output.
|
||||
* * `node.dns.native`: Enables capture of trace data for DNS queries.
|
||||
* * `node.environment`: Enables capture of Node.js Environment milestones.
|
||||
* * `node.fs.sync`: Enables capture of trace data for file system sync methods.
|
||||
* * `node.perf`: Enables capture of `Performance API` measurements.
|
||||
* * `node.perf.usertiming`: Enables capture of only Performance API User Timing
|
||||
* measures and marks.
|
||||
* * `node.perf.timerify`: Enables capture of only Performance API timerify
|
||||
* measurements.
|
||||
* * `node.promises.rejections`: Enables capture of trace data tracking the number
|
||||
* of unhandled Promise rejections and handled-after-rejections.
|
||||
* * `node.vm.script`: Enables capture of trace data for the `vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
|
||||
* * `v8`: The `V8` events are GC, compiling, and execution related.
|
||||
*
|
||||
* By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
|
||||
*
|
||||
* ```bash
|
||||
* node --trace-event-categories v8,node,node.async_hooks server.js
|
||||
* ```
|
||||
*
|
||||
* Prior versions of Node.js required the use of the `--trace-events-enabled`flag to enable trace events. This requirement has been removed. However, the`--trace-events-enabled` flag _may_ still be
|
||||
* used and will enable the`node`, `node.async_hooks`, and `v8` trace event categories by default.
|
||||
*
|
||||
* ```bash
|
||||
* node --trace-events-enabled
|
||||
*
|
||||
* # is equivalent to
|
||||
*
|
||||
* node --trace-event-categories v8,node,node.async_hooks
|
||||
* ```
|
||||
*
|
||||
* Alternatively, trace events may be enabled using the `trace_events` module:
|
||||
*
|
||||
* ```js
|
||||
* const trace_events = require('trace_events');
|
||||
* const tracing = trace_events.createTracing({ categories: ['node.perf'] });
|
||||
* tracing.enable(); // Enable trace event capture for the 'node.perf' category
|
||||
*
|
||||
* // do work
|
||||
*
|
||||
* tracing.disable(); // Disable trace event capture for the 'node.perf' category
|
||||
* ```
|
||||
*
|
||||
* Running Node.js with tracing enabled will produce log files that can be opened
|
||||
* in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome.
|
||||
*
|
||||
* The logging file is by default called `node_trace.${rotation}.log`, where`${rotation}` is an incrementing log-rotation id. The filepath pattern can
|
||||
* be specified with `--trace-event-file-pattern` that accepts a template
|
||||
* string that supports `${rotation}` and `${pid}`:
|
||||
*
|
||||
* ```bash
|
||||
* node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
|
||||
* ```
|
||||
*
|
||||
* To guarantee that the log file is properly generated after signal events like`SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers
|
||||
* in your code, such as:
|
||||
*
|
||||
* ```js
|
||||
* process.on('SIGINT', function onSigint() {
|
||||
* console.info('Received SIGINT.');
|
||||
* process.exit(130); // Or applicable exit code depending on OS and signal
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* The tracing system uses the same time source
|
||||
* as the one used by `process.hrtime()`.
|
||||
* However the trace-event timestamps are expressed in microseconds,
|
||||
* unlike `process.hrtime()` which returns nanoseconds.
|
||||
*
|
||||
* The features from this module are not available in `Worker` threads.
|
||||
* @experimental
|
||||
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/trace_events.js)
|
||||
*/
|
||||
declare module 'trace_events' {
|
||||
/**
|
||||
* The `Tracing` object is used to enable or disable tracing for sets of
|
||||
* categories. Instances are created using the
|
||||
* `trace_events.createTracing()` method.
|
||||
*
|
||||
* When created, the `Tracing` object is disabled. Calling the
|
||||
* `tracing.enable()` method adds the categories to the set of enabled trace
|
||||
* event categories. Calling `tracing.disable()` will remove the categories
|
||||
* from the set of enabled trace event categories.
|
||||
*/
|
||||
interface Tracing {
|
||||
/**
|
||||
* A comma-separated list of the trace event categories covered by this
|
||||
* `Tracing` object.
|
||||
*/
|
||||
readonly categories: string;
|
||||
/**
|
||||
* Disables this `Tracing` object.
|
||||
*
|
||||
* Only trace event categories _not_ covered by other enabled `Tracing`
|
||||
* objects and _not_ specified by the `--trace-event-categories` flag
|
||||
* will be disabled.
|
||||
*/
|
||||
disable(): void;
|
||||
/**
|
||||
* Enables this `Tracing` object for the set of categories covered by
|
||||
* the `Tracing` object.
|
||||
*/
|
||||
enable(): void;
|
||||
/**
|
||||
* `true` only if the `Tracing` object has been enabled.
|
||||
*/
|
||||
readonly enabled: boolean;
|
||||
}
|
||||
interface CreateTracingOptions {
|
||||
/**
|
||||
* An array of trace category names. Values included in the array are
|
||||
* coerced to a string when possible. An error will be thrown if the
|
||||
* value cannot be coerced.
|
||||
*/
|
||||
categories: string[];
|
||||
}
|
||||
/**
|
||||
* Creates and returns a `Tracing` object for the given set of `categories`.
|
||||
*
|
||||
* ```js
|
||||
* const trace_events = require('trace_events');
|
||||
* const categories = ['node.perf', 'node.async_hooks'];
|
||||
* const tracing = trace_events.createTracing({ categories });
|
||||
* tracing.enable();
|
||||
* // do stuff
|
||||
* tracing.disable();
|
||||
* ```
|
||||
* @since v10.0.0
|
||||
* @return .
|
||||
*/
|
||||
function createTracing(options: CreateTracingOptions): Tracing;
|
||||
/**
|
||||
* Returns a comma-separated list of all currently-enabled trace event
|
||||
* categories. The current set of enabled trace event categories is determined
|
||||
* by the _union_ of all currently-enabled `Tracing` objects and any categories
|
||||
* enabled using the `--trace-event-categories` flag.
|
||||
*
|
||||
* Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console.
|
||||
*
|
||||
* ```js
|
||||
* const trace_events = require('trace_events');
|
||||
* const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
|
||||
* const t2 = trace_events.createTracing({ categories: ['node.perf'] });
|
||||
* const t3 = trace_events.createTracing({ categories: ['v8'] });
|
||||
*
|
||||
* t1.enable();
|
||||
* t2.enable();
|
||||
*
|
||||
* console.log(trace_events.getEnabledCategories());
|
||||
* ```
|
||||
* @since v10.0.0
|
||||
*/
|
||||
function getEnabledCategories(): string | undefined;
|
||||
}
|
||||
declare module 'node:trace_events' {
|
||||
export * from 'trace_events';
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"createErrorClass.js","sourceRoot":"","sources":["../../../../src/internal/util/createErrorClass.ts"],"names":[],"mappings":";;;AASA,SAAgB,gBAAgB,CAAI,UAAgC;IAClE,IAAM,MAAM,GAAG,UAAC,QAAa;QAC3B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,QAAQ,CAAC,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;IACrC,CAAC,CAAC;IAEF,IAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACpD,QAAQ,CAAC,SAAS,CAAC,WAAW,GAAG,QAAQ,CAAC;IAC1C,OAAO,QAAQ,CAAC;AAClB,CAAC;AAVD,4CAUC"}
|
||||
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
|
||||
var isPlainFunction = require("type/plain-function/is")
|
||||
, ensureValue = require("type/value/ensure")
|
||||
, isValue = require("type/value/is")
|
||||
, map = require("es5-ext/object/map")
|
||||
, contains = require("es5-ext/string/#/contains");
|
||||
|
||||
var call = Function.prototype.call
|
||||
, defineProperty = Object.defineProperty
|
||||
, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor
|
||||
, getPrototypeOf = Object.getPrototypeOf
|
||||
, hasOwnProperty = Object.prototype.hasOwnProperty
|
||||
, cacheDesc = { configurable: false, enumerable: false, writable: false, value: null }
|
||||
, define;
|
||||
|
||||
define = function (name, options) {
|
||||
var value, dgs, cacheName, desc, writable = false, resolvable, flat;
|
||||
options = Object(ensureValue(options));
|
||||
cacheName = options.cacheName;
|
||||
flat = options.flat;
|
||||
if (!isValue(cacheName)) cacheName = name;
|
||||
delete options.cacheName;
|
||||
value = options.value;
|
||||
resolvable = isPlainFunction(value);
|
||||
delete options.value;
|
||||
dgs = { configurable: Boolean(options.configurable), enumerable: Boolean(options.enumerable) };
|
||||
if (name !== cacheName) {
|
||||
dgs.get = function () {
|
||||
if (hasOwnProperty.call(this, cacheName)) return this[cacheName];
|
||||
cacheDesc.value = resolvable ? call.call(value, this, options) : value;
|
||||
cacheDesc.writable = writable;
|
||||
defineProperty(this, cacheName, cacheDesc);
|
||||
cacheDesc.value = null;
|
||||
if (desc) defineProperty(this, name, desc);
|
||||
return this[cacheName];
|
||||
};
|
||||
} else if (!flat) {
|
||||
dgs.get = function self() {
|
||||
var ownDesc;
|
||||
if (hasOwnProperty.call(this, name)) {
|
||||
ownDesc = getOwnPropertyDescriptor(this, name);
|
||||
// It happens in Safari, that getter is still called after property
|
||||
// was defined with a value, following workarounds that
|
||||
// While in IE11 it may happen that here ownDesc is undefined (go figure)
|
||||
if (ownDesc) {
|
||||
if (ownDesc.hasOwnProperty("value")) return ownDesc.value;
|
||||
if (typeof ownDesc.get === "function" && ownDesc.get !== self) {
|
||||
return ownDesc.get.call(this);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
desc.value = resolvable ? call.call(value, this, options) : value;
|
||||
defineProperty(this, name, desc);
|
||||
desc.value = null;
|
||||
return this[name];
|
||||
};
|
||||
} else {
|
||||
dgs.get = function self() {
|
||||
var base = this, ownDesc;
|
||||
if (hasOwnProperty.call(this, name)) {
|
||||
// It happens in Safari, that getter is still called after property
|
||||
// was defined with a value, following workarounds that
|
||||
ownDesc = getOwnPropertyDescriptor(this, name);
|
||||
if (ownDesc.hasOwnProperty("value")) return ownDesc.value;
|
||||
if (typeof ownDesc.get === "function" && ownDesc.get !== self) {
|
||||
return ownDesc.get.call(this);
|
||||
}
|
||||
}
|
||||
while (!hasOwnProperty.call(base, name)) base = getPrototypeOf(base);
|
||||
desc.value = resolvable ? call.call(value, base, options) : value;
|
||||
defineProperty(base, name, desc);
|
||||
desc.value = null;
|
||||
return base[name];
|
||||
};
|
||||
}
|
||||
dgs.set = function (value) {
|
||||
if (hasOwnProperty.call(this, name)) {
|
||||
throw new TypeError("Cannot assign to lazy defined '" + name + "' property of " + this);
|
||||
}
|
||||
dgs.get.call(this);
|
||||
this[cacheName] = value;
|
||||
};
|
||||
if (options.desc) {
|
||||
desc = {
|
||||
configurable: contains.call(options.desc, "c"),
|
||||
enumerable: contains.call(options.desc, "e")
|
||||
};
|
||||
if (cacheName === name) {
|
||||
desc.writable = contains.call(options.desc, "w");
|
||||
desc.value = null;
|
||||
} else {
|
||||
writable = contains.call(options.desc, "w");
|
||||
desc.get = dgs.get;
|
||||
desc.set = dgs.set;
|
||||
}
|
||||
delete options.desc;
|
||||
} else if (cacheName === name) {
|
||||
desc = {
|
||||
configurable: Boolean(options.configurable),
|
||||
enumerable: Boolean(options.enumerable),
|
||||
writable: Boolean(options.writable),
|
||||
value: null
|
||||
};
|
||||
}
|
||||
delete options.configurable;
|
||||
delete options.enumerable;
|
||||
delete options.writable;
|
||||
return dgs;
|
||||
};
|
||||
|
||||
module.exports = function (props) {
|
||||
return map(props, function (desc, name) { return define(name, desc); });
|
||||
};
|
||||
@@ -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,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0.00437,"49":0,"50":0,"51":0,"52":0,"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.03061,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0.00875,"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,"100":0,"101":0,"102":0.00437,"103":0,"104":0,"105":0,"106":0,"107":0.00437,"108":0.01312,"109":0.68219,"110":0.36296,"111":0,"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,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00875,"50":0,"51":0,"52":0,"53":0.01312,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0.00437,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.00875,"74":0,"75":0,"76":0.00437,"77":0.00437,"78":0,"79":0.03936,"80":0,"81":0,"83":0.00875,"84":0,"85":0.00437,"86":0.00437,"87":0.01312,"88":0,"89":0,"90":0,"91":0.01312,"92":0.03498,"93":0.00875,"94":0,"95":0,"96":0.00875,"97":0.00437,"98":0.00875,"99":0.04373,"100":0.00437,"101":0.00437,"102":0,"103":0.09183,"104":0.00875,"105":0.03061,"106":0.01312,"107":0.03936,"108":0.33672,"109":5.84233,"110":3.59461,"111":0.03498,"112":0,"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.00437,"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,"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,"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.01749,"94":0.15743,"95":0.07434,"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,"13":0,"14":0,"15":0,"16":0,"17":0.01749,"18":0,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00437,"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.00875,"106":0.00437,"107":0.0481,"108":0.03061,"109":1.60926,"110":1.30753},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00875,"14":0.08746,"15":0.04373,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0.00437,"12.1":0.03936,"13.1":0.1137,"14.1":0.14431,"15.1":0.02187,"15.2-15.3":0.03498,"15.4":0.13119,"15.5":0.18367,"15.6":0.85711,"16.0":0.03498,"16.1":0.37171,"16.2":0.65595,"16.3":0.41981,"16.4":0},G:{"8":0,"3.2":0,"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,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.60974,"10.0-10.2":0,"10.3":0.04517,"11.0-11.2":0,"11.3-11.4":0.15808,"12.0-12.1":0.23486,"12.2-12.5":1.23754,"13.0-13.1":0.00903,"13.2":0.1355,"13.3":0.06775,"13.4-13.7":0.16711,"14.0-14.4":0.41552,"14.5-14.8":0.86718,"15.0-15.1":0.31164,"15.2-15.3":0.71362,"15.4":0.35229,"15.5":1.3098,"15.6":4.67012,"16.0":4.94112,"16.1":10.09903,"16.2":10.4197,"16.3":6.19672,"16.4":0.02258},P:{"4":0.23177,"20":1.78039,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.0316,"8.2":0,"9.2":0.01053,"10.1":0,"11.1-11.2":0.0316,"12.0":0,"13.0":0.01053,"14.0":0.02107,"15.0":0.01053,"16.0":0.08428,"17.0":0.08428,"18.0":0.13695,"19.0":2.26499},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.17306},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00437,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.03376},H:{"0":0.1758},L:{"0":29.59092},R:{_:"0"},M:{"0":0.21945},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "es-array-method-boxes-properly",
|
||||
"version": "1.0.0",
|
||||
"description": "Utility package to determine if an `Array.prototype` method properly boxes the callback's receiver and third argument.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"prepublish": "safe-publish-latest",
|
||||
"lint": "eslint .",
|
||||
"pretest": "npm run lint",
|
||||
"tests-only": "node test",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "npx aud"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ljharb/es-array-method-boxes-properly.git"
|
||||
},
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ljharb/es-array-method-boxes-properly/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ljharb/es-array-method-boxes-properly#readme",
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^14.1.0",
|
||||
"eslint": "^6.4.0",
|
||||
"safe-publish-latest": "^1.1.3",
|
||||
"tape": "^4.11.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
"use strict";;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var types_1 = tslib_1.__importDefault(require("../lib/types"));
|
||||
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
|
||||
function default_1(fork) {
|
||||
var types = fork.use(types_1.default);
|
||||
var Type = types.Type;
|
||||
var def = Type.def;
|
||||
var or = Type.or;
|
||||
var shared = fork.use(shared_1.default);
|
||||
var defaults = shared.defaults;
|
||||
var geq = shared.geq;
|
||||
// Abstract supertype of all syntactic entities that are allowed to have a
|
||||
// .loc field.
|
||||
def("Printable")
|
||||
.field("loc", or(def("SourceLocation"), null), defaults["null"], true);
|
||||
def("Node")
|
||||
.bases("Printable")
|
||||
.field("type", String)
|
||||
.field("comments", or([def("Comment")], null), defaults["null"], true);
|
||||
def("SourceLocation")
|
||||
.field("start", def("Position"))
|
||||
.field("end", def("Position"))
|
||||
.field("source", or(String, null), defaults["null"]);
|
||||
def("Position")
|
||||
.field("line", geq(1))
|
||||
.field("column", geq(0));
|
||||
def("File")
|
||||
.bases("Node")
|
||||
.build("program", "name")
|
||||
.field("program", def("Program"))
|
||||
.field("name", or(String, null), defaults["null"]);
|
||||
def("Program")
|
||||
.bases("Node")
|
||||
.build("body")
|
||||
.field("body", [def("Statement")]);
|
||||
def("Function")
|
||||
.bases("Node")
|
||||
.field("id", or(def("Identifier"), null), defaults["null"])
|
||||
.field("params", [def("Pattern")])
|
||||
.field("body", def("BlockStatement"))
|
||||
.field("generator", Boolean, defaults["false"])
|
||||
.field("async", Boolean, defaults["false"]);
|
||||
def("Statement").bases("Node");
|
||||
// The empty .build() here means that an EmptyStatement can be constructed
|
||||
// (i.e. it's not abstract) but that it needs no arguments.
|
||||
def("EmptyStatement").bases("Statement").build();
|
||||
def("BlockStatement")
|
||||
.bases("Statement")
|
||||
.build("body")
|
||||
.field("body", [def("Statement")]);
|
||||
// TODO Figure out how to silently coerce Expressions to
|
||||
// ExpressionStatements where a Statement was expected.
|
||||
def("ExpressionStatement")
|
||||
.bases("Statement")
|
||||
.build("expression")
|
||||
.field("expression", def("Expression"));
|
||||
def("IfStatement")
|
||||
.bases("Statement")
|
||||
.build("test", "consequent", "alternate")
|
||||
.field("test", def("Expression"))
|
||||
.field("consequent", def("Statement"))
|
||||
.field("alternate", or(def("Statement"), null), defaults["null"]);
|
||||
def("LabeledStatement")
|
||||
.bases("Statement")
|
||||
.build("label", "body")
|
||||
.field("label", def("Identifier"))
|
||||
.field("body", def("Statement"));
|
||||
def("BreakStatement")
|
||||
.bases("Statement")
|
||||
.build("label")
|
||||
.field("label", or(def("Identifier"), null), defaults["null"]);
|
||||
def("ContinueStatement")
|
||||
.bases("Statement")
|
||||
.build("label")
|
||||
.field("label", or(def("Identifier"), null), defaults["null"]);
|
||||
def("WithStatement")
|
||||
.bases("Statement")
|
||||
.build("object", "body")
|
||||
.field("object", def("Expression"))
|
||||
.field("body", def("Statement"));
|
||||
def("SwitchStatement")
|
||||
.bases("Statement")
|
||||
.build("discriminant", "cases", "lexical")
|
||||
.field("discriminant", def("Expression"))
|
||||
.field("cases", [def("SwitchCase")])
|
||||
.field("lexical", Boolean, defaults["false"]);
|
||||
def("ReturnStatement")
|
||||
.bases("Statement")
|
||||
.build("argument")
|
||||
.field("argument", or(def("Expression"), null));
|
||||
def("ThrowStatement")
|
||||
.bases("Statement")
|
||||
.build("argument")
|
||||
.field("argument", def("Expression"));
|
||||
def("TryStatement")
|
||||
.bases("Statement")
|
||||
.build("block", "handler", "finalizer")
|
||||
.field("block", def("BlockStatement"))
|
||||
.field("handler", or(def("CatchClause"), null), function () {
|
||||
return this.handlers && this.handlers[0] || null;
|
||||
})
|
||||
.field("handlers", [def("CatchClause")], function () {
|
||||
return this.handler ? [this.handler] : [];
|
||||
}, true) // Indicates this field is hidden from eachField iteration.
|
||||
.field("guardedHandlers", [def("CatchClause")], defaults.emptyArray)
|
||||
.field("finalizer", or(def("BlockStatement"), null), defaults["null"]);
|
||||
def("CatchClause")
|
||||
.bases("Node")
|
||||
.build("param", "guard", "body")
|
||||
// https://github.com/tc39/proposal-optional-catch-binding
|
||||
.field("param", or(def("Pattern"), null), defaults["null"])
|
||||
.field("guard", or(def("Expression"), null), defaults["null"])
|
||||
.field("body", def("BlockStatement"));
|
||||
def("WhileStatement")
|
||||
.bases("Statement")
|
||||
.build("test", "body")
|
||||
.field("test", def("Expression"))
|
||||
.field("body", def("Statement"));
|
||||
def("DoWhileStatement")
|
||||
.bases("Statement")
|
||||
.build("body", "test")
|
||||
.field("body", def("Statement"))
|
||||
.field("test", def("Expression"));
|
||||
def("ForStatement")
|
||||
.bases("Statement")
|
||||
.build("init", "test", "update", "body")
|
||||
.field("init", or(def("VariableDeclaration"), def("Expression"), null))
|
||||
.field("test", or(def("Expression"), null))
|
||||
.field("update", or(def("Expression"), null))
|
||||
.field("body", def("Statement"));
|
||||
def("ForInStatement")
|
||||
.bases("Statement")
|
||||
.build("left", "right", "body")
|
||||
.field("left", or(def("VariableDeclaration"), def("Expression")))
|
||||
.field("right", def("Expression"))
|
||||
.field("body", def("Statement"));
|
||||
def("DebuggerStatement").bases("Statement").build();
|
||||
def("Declaration").bases("Statement");
|
||||
def("FunctionDeclaration")
|
||||
.bases("Function", "Declaration")
|
||||
.build("id", "params", "body")
|
||||
.field("id", def("Identifier"));
|
||||
def("FunctionExpression")
|
||||
.bases("Function", "Expression")
|
||||
.build("id", "params", "body");
|
||||
def("VariableDeclaration")
|
||||
.bases("Declaration")
|
||||
.build("kind", "declarations")
|
||||
.field("kind", or("var", "let", "const"))
|
||||
.field("declarations", [def("VariableDeclarator")]);
|
||||
def("VariableDeclarator")
|
||||
.bases("Node")
|
||||
.build("id", "init")
|
||||
.field("id", def("Pattern"))
|
||||
.field("init", or(def("Expression"), null), defaults["null"]);
|
||||
def("Expression").bases("Node");
|
||||
def("ThisExpression").bases("Expression").build();
|
||||
def("ArrayExpression")
|
||||
.bases("Expression")
|
||||
.build("elements")
|
||||
.field("elements", [or(def("Expression"), null)]);
|
||||
def("ObjectExpression")
|
||||
.bases("Expression")
|
||||
.build("properties")
|
||||
.field("properties", [def("Property")]);
|
||||
// TODO Not in the Mozilla Parser API, but used by Esprima.
|
||||
def("Property")
|
||||
.bases("Node") // Want to be able to visit Property Nodes.
|
||||
.build("kind", "key", "value")
|
||||
.field("kind", or("init", "get", "set"))
|
||||
.field("key", or(def("Literal"), def("Identifier")))
|
||||
.field("value", def("Expression"));
|
||||
def("SequenceExpression")
|
||||
.bases("Expression")
|
||||
.build("expressions")
|
||||
.field("expressions", [def("Expression")]);
|
||||
var UnaryOperator = or("-", "+", "!", "~", "typeof", "void", "delete");
|
||||
def("UnaryExpression")
|
||||
.bases("Expression")
|
||||
.build("operator", "argument", "prefix")
|
||||
.field("operator", UnaryOperator)
|
||||
.field("argument", def("Expression"))
|
||||
// Esprima doesn't bother with this field, presumably because it's
|
||||
// always true for unary operators.
|
||||
.field("prefix", Boolean, defaults["true"]);
|
||||
var BinaryOperator = or("==", "!=", "===", "!==", "<", "<=", ">", ">=", "<<", ">>", ">>>", "+", "-", "*", "/", "%", "**", "&", // TODO Missing from the Parser API.
|
||||
"|", "^", "in", "instanceof");
|
||||
def("BinaryExpression")
|
||||
.bases("Expression")
|
||||
.build("operator", "left", "right")
|
||||
.field("operator", BinaryOperator)
|
||||
.field("left", def("Expression"))
|
||||
.field("right", def("Expression"));
|
||||
var AssignmentOperator = or("=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", "|=", "^=", "&=");
|
||||
def("AssignmentExpression")
|
||||
.bases("Expression")
|
||||
.build("operator", "left", "right")
|
||||
.field("operator", AssignmentOperator)
|
||||
.field("left", or(def("Pattern"), def("MemberExpression")))
|
||||
.field("right", def("Expression"));
|
||||
var UpdateOperator = or("++", "--");
|
||||
def("UpdateExpression")
|
||||
.bases("Expression")
|
||||
.build("operator", "argument", "prefix")
|
||||
.field("operator", UpdateOperator)
|
||||
.field("argument", def("Expression"))
|
||||
.field("prefix", Boolean);
|
||||
var LogicalOperator = or("||", "&&");
|
||||
def("LogicalExpression")
|
||||
.bases("Expression")
|
||||
.build("operator", "left", "right")
|
||||
.field("operator", LogicalOperator)
|
||||
.field("left", def("Expression"))
|
||||
.field("right", def("Expression"));
|
||||
def("ConditionalExpression")
|
||||
.bases("Expression")
|
||||
.build("test", "consequent", "alternate")
|
||||
.field("test", def("Expression"))
|
||||
.field("consequent", def("Expression"))
|
||||
.field("alternate", def("Expression"));
|
||||
def("NewExpression")
|
||||
.bases("Expression")
|
||||
.build("callee", "arguments")
|
||||
.field("callee", def("Expression"))
|
||||
// The Mozilla Parser API gives this type as [or(def("Expression"),
|
||||
// null)], but null values don't really make sense at the call site.
|
||||
// TODO Report this nonsense.
|
||||
.field("arguments", [def("Expression")]);
|
||||
def("CallExpression")
|
||||
.bases("Expression")
|
||||
.build("callee", "arguments")
|
||||
.field("callee", def("Expression"))
|
||||
// See comment for NewExpression above.
|
||||
.field("arguments", [def("Expression")]);
|
||||
def("MemberExpression")
|
||||
.bases("Expression")
|
||||
.build("object", "property", "computed")
|
||||
.field("object", def("Expression"))
|
||||
.field("property", or(def("Identifier"), def("Expression")))
|
||||
.field("computed", Boolean, function () {
|
||||
var type = this.property.type;
|
||||
if (type === 'Literal' ||
|
||||
type === 'MemberExpression' ||
|
||||
type === 'BinaryExpression') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
def("Pattern").bases("Node");
|
||||
def("SwitchCase")
|
||||
.bases("Node")
|
||||
.build("test", "consequent")
|
||||
.field("test", or(def("Expression"), null))
|
||||
.field("consequent", [def("Statement")]);
|
||||
def("Identifier")
|
||||
.bases("Expression", "Pattern")
|
||||
.build("name")
|
||||
.field("name", String)
|
||||
.field("optional", Boolean, defaults["false"]);
|
||||
def("Literal")
|
||||
.bases("Expression")
|
||||
.build("value")
|
||||
.field("value", or(String, Boolean, null, Number, RegExp))
|
||||
.field("regex", or({
|
||||
pattern: String,
|
||||
flags: String
|
||||
}, null), function () {
|
||||
if (this.value instanceof RegExp) {
|
||||
var flags = "";
|
||||
if (this.value.ignoreCase)
|
||||
flags += "i";
|
||||
if (this.value.multiline)
|
||||
flags += "m";
|
||||
if (this.value.global)
|
||||
flags += "g";
|
||||
return {
|
||||
pattern: this.value.source,
|
||||
flags: flags
|
||||
};
|
||||
}
|
||||
return null;
|
||||
});
|
||||
// Abstract (non-buildable) comment supertype. Not a Node.
|
||||
def("Comment")
|
||||
.bases("Printable")
|
||||
.field("value", String)
|
||||
// A .leading comment comes before the node, whereas a .trailing
|
||||
// comment comes after it. These two fields should not both be true,
|
||||
// but they might both be false when the comment falls inside a node
|
||||
// and the node has no children for the comment to lead or trail,
|
||||
// e.g. { /*dangling*/ }.
|
||||
.field("leading", Boolean, defaults["true"])
|
||||
.field("trailing", Boolean, defaults["false"]);
|
||||
}
|
||||
exports.default = default_1;
|
||||
module.exports = exports["default"];
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"postcss-value-parser","version":"4.2.0","files":{"LICENSE":{"checkedAt":1678883670334,"integrity":"sha512-XKa66wOLW8mnxzbgny39djP+oLGiQF8EVa8Ca3siBEhFmK/8GVQvkzCMnnLbTtuw6aVV8Gs6Kbc8a2gp3WXKKA==","mode":420,"size":1074},"lib/index.js":{"checkedAt":1678883670334,"integrity":"sha512-NYYLijei7Z2MxghcjRLz+LdUdd3clVnUvRgQXUEkPVIa4CQEibsrIhYJjMnye9QHexaq2pwQqLTcYDa6m8kwaQ==","mode":420,"size":607},"lib/stringify.js":{"checkedAt":1678883670334,"integrity":"sha512-JN4xyBy26VsHYTWQZV0ZNEJBnFTjy+ka9QLVpNGIopZh7qgbziT3VoQxCCRYEkXxZMfd2zHGgwFPMvrKrrhuqA==","mode":420,"size":1185},"lib/parse.js":{"checkedAt":1678883670334,"integrity":"sha512-MyDhbQMgTcFyvviJOZXps5tGdk198CbUzf0QjBGPKzOKFB6IrG2e2mrTpPhlqvqCYkLV5jBY0bLd9lnssgJDbw==","mode":420,"size":8344},"lib/unit.js":{"checkedAt":1678883670338,"integrity":"sha512-r6jGGlO29EvnJqEoGn9U694IjX/UTK+N0x1hyzfdlxQhd1nhHDcKerrO5T7voPLYPBu4So6jkiASCfodVy3e8Q==","mode":420,"size":2283},"lib/walk.js":{"checkedAt":1678883670338,"integrity":"sha512-c8xiiDPW9WUTE/d6PrVVCLDytPdhWrt7misdRZ4ROZEkrFOIJk+SLAKARTst2FhZgC5EJMTkIkYjT6KxWacQ9Q==","mode":420,"size":425},"package.json":{"checkedAt":1678883670338,"integrity":"sha512-Vul5dhi4nQ97oxw8XcP+tBNzJydP55zCwEDt661ZgD9hcnaLbsvqo5P2b7bJ/Mvj1QfNrvFviW6SQO0WT2mJiA==","mode":420,"size":1302},"README.md":{"checkedAt":1678883670338,"integrity":"sha512-9vb6zM85q1D8QFyivLjYQ74/gozxj99bnHh6GIr3pAKWZurYZLeF3CmEs7BdtuAU0FjFiMDUBdKoFpua3DVj1g==","mode":420,"size":7683},"lib/index.d.ts":{"checkedAt":1678883670342,"integrity":"sha512-Do7KxLTs0LCKMgNCZOc+dCSKDagit/E38s7RUB0dBDvd8PeuYPLzjmZ3o0J6/y9NGb0PeM+CIpiMhN66iuersg==","mode":420,"size":4290}}}
|
||||
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"name": "@szmarczak/http-timer",
|
||||
"version": "5.0.1",
|
||||
"description": "Timings for HTTP requests",
|
||||
"type": "module",
|
||||
"exports": "./dist/source/index.js",
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava",
|
||||
"build": "del-cli dist && tsc",
|
||||
"prepare": "npm run build",
|
||||
"coveralls": "exit 0 && nyc report --reporter=text-lcov | coveralls"
|
||||
},
|
||||
"files": [
|
||||
"dist/source"
|
||||
],
|
||||
"keywords": [
|
||||
"http",
|
||||
"https",
|
||||
"http2",
|
||||
"timer",
|
||||
"timings",
|
||||
"performance",
|
||||
"measure"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/szmarczak/http-timer.git"
|
||||
},
|
||||
"author": "Szymon Marczak",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/szmarczak/http-timer/issues"
|
||||
},
|
||||
"homepage": "https://github.com/szmarczak/http-timer#readme",
|
||||
"dependencies": {
|
||||
"defer-to-connect": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ava/typescript": "^2.0.0",
|
||||
"@sindresorhus/tsconfig": "^1.0.2",
|
||||
"@types/node": "^16.7.0",
|
||||
"ava": "^3.15.0",
|
||||
"coveralls": "^3.1.1",
|
||||
"del-cli": "^4.0.1",
|
||||
"http2-wrapper": "^2.1.4",
|
||||
"nyc": "^15.1.0",
|
||||
"p-event": "^4.2.0",
|
||||
"ts-node": "^10.2.1",
|
||||
"typescript": "^4.3.5",
|
||||
"xo": "^0.44.0"
|
||||
},
|
||||
"types": "dist/source",
|
||||
"nyc": {
|
||||
"extension": [
|
||||
".ts"
|
||||
],
|
||||
"exclude": [
|
||||
"**/tests/**"
|
||||
]
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-unsafe-assignment": "off",
|
||||
"@typescript-eslint/no-unsafe-member-access": "off",
|
||||
"@typescript-eslint/no-unsafe-call": "off",
|
||||
"unicorn/prefer-node-protocol": "off"
|
||||
}
|
||||
},
|
||||
"ava": {
|
||||
"files": [
|
||||
"tests/*"
|
||||
],
|
||||
"timeout": "1m",
|
||||
"nonSemVerExperiments": {
|
||||
"nextGenConfig": true,
|
||||
"configurableModuleFormat": true
|
||||
},
|
||||
"extensions": {
|
||||
"ts": "module"
|
||||
},
|
||||
"nodeArguments": [
|
||||
"--loader=ts-node/esm"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
declare const _default: {
|
||||
search: {
|
||||
placeholder: string;
|
||||
};
|
||||
sort: {
|
||||
sortAsc: string;
|
||||
sortDesc: string;
|
||||
};
|
||||
pagination: {
|
||||
previous: string;
|
||||
next: string;
|
||||
navigate: (page: any, pages: any) => string;
|
||||
page: (page: any) => string;
|
||||
showing: string;
|
||||
of: string;
|
||||
to: string;
|
||||
results: string;
|
||||
};
|
||||
loading: string;
|
||||
noRecordsFound: string;
|
||||
error: string;
|
||||
};
|
||||
export default _default;
|
||||
@@ -0,0 +1,147 @@
|
||||
import { LDMLPluralRule } from './plural-rules';
|
||||
import { LocaleData } from './core';
|
||||
export declare type NumberFormatNotation = 'standard' | 'scientific' | 'engineering' | 'compact';
|
||||
export declare type NumberFormatRoundingType = 'significantDigits' | 'fractionDigits' | 'compactRounding';
|
||||
export interface NumberFormatDigitOptions {
|
||||
minimumIntegerDigits?: number;
|
||||
minimumSignificantDigits?: number;
|
||||
maximumSignificantDigits?: number;
|
||||
minimumFractionDigits?: number;
|
||||
maximumFractionDigits?: number;
|
||||
}
|
||||
export interface NumberFormatDigitInternalSlots {
|
||||
minimumIntegerDigits: number;
|
||||
minimumSignificantDigits?: number;
|
||||
maximumSignificantDigits?: number;
|
||||
roundingType: NumberFormatRoundingType;
|
||||
minimumFractionDigits?: number;
|
||||
maximumFractionDigits?: number;
|
||||
notation?: NumberFormatNotation;
|
||||
}
|
||||
export declare type RawNumberLocaleData = LocaleData<NumberFormatLocaleInternalData>;
|
||||
export interface NumberFormatLocaleInternalData {
|
||||
units: UnitDataTable;
|
||||
currencies: Record<string, CurrencyData>;
|
||||
numbers: RawNumberData;
|
||||
nu: string[];
|
||||
}
|
||||
export interface UnitDataTable {
|
||||
simple: Record<string, UnitData>;
|
||||
compound: Record<string, CompoundUnitData>;
|
||||
}
|
||||
export interface UnitData {
|
||||
long: LDMLPluralRuleMap<string>;
|
||||
short: LDMLPluralRuleMap<string>;
|
||||
narrow: LDMLPluralRuleMap<string>;
|
||||
perUnit: Record<'narrow' | 'short' | 'long', string | undefined>;
|
||||
}
|
||||
export interface CompoundUnitData {
|
||||
long: string;
|
||||
short: string;
|
||||
narrow: string;
|
||||
}
|
||||
export interface CurrencyData {
|
||||
displayName: LDMLPluralRuleMap<string>;
|
||||
symbol: string;
|
||||
narrow: string;
|
||||
}
|
||||
export declare type DecimalFormatNum = '1000' | '10000' | '100000' | '1000000' | '10000000' | '100000000' | '1000000000' | '10000000000' | '100000000000' | '1000000000000' | '10000000000000' | '100000000000000';
|
||||
export declare type NumberingSystem = string;
|
||||
/**
|
||||
* We only care about insertBetween bc we assume
|
||||
* `currencyMatch` & `surroundingMatch` are all the same
|
||||
*
|
||||
* @export
|
||||
* @interface CurrencySpacingData
|
||||
*/
|
||||
export interface CurrencySpacingData {
|
||||
beforeInsertBetween: string;
|
||||
afterInsertBetween: string;
|
||||
}
|
||||
export interface RawCurrencyData {
|
||||
currencySpacing: CurrencySpacingData;
|
||||
standard: string;
|
||||
accounting: string;
|
||||
short?: Record<DecimalFormatNum, LDMLPluralRuleMap<string>>;
|
||||
unitPattern: string;
|
||||
}
|
||||
export interface SymbolsData {
|
||||
decimal: string;
|
||||
group: string;
|
||||
list: string;
|
||||
percentSign: string;
|
||||
plusSign: string;
|
||||
minusSign: string;
|
||||
exponential: string;
|
||||
superscriptingExponent: string;
|
||||
perMille: string;
|
||||
infinity: string;
|
||||
nan: string;
|
||||
timeSeparator: string;
|
||||
}
|
||||
export interface RawNumberData {
|
||||
nu: string[];
|
||||
symbols: Record<NumberingSystem, SymbolsData>;
|
||||
decimal: Record<NumberingSystem, {
|
||||
standard: string;
|
||||
long: Record<DecimalFormatNum, LDMLPluralRuleMap<string>>;
|
||||
short: Record<DecimalFormatNum, LDMLPluralRuleMap<string>>;
|
||||
}>;
|
||||
percent: Record<NumberingSystem, string>;
|
||||
currency: Record<NumberingSystem, RawCurrencyData>;
|
||||
}
|
||||
export declare type LDMLPluralRuleMap<T> = Omit<Partial<Record<LDMLPluralRule, T>>, 'other'> & {
|
||||
other: T;
|
||||
};
|
||||
export interface RawNumberFormatResult {
|
||||
formattedString: string;
|
||||
roundedNumber: number;
|
||||
integerDigitsCount: number;
|
||||
}
|
||||
export declare type NumberFormatOptionsLocaleMatcher = 'lookup' | 'best fit';
|
||||
export declare type NumberFormatOptionsStyle = 'decimal' | 'percent' | 'currency' | 'unit';
|
||||
export declare type NumberFormatOptionsCompactDisplay = 'short' | 'long';
|
||||
export declare type NumberFormatOptionsCurrencyDisplay = 'symbol' | 'code' | 'name' | 'narrowSymbol';
|
||||
export declare type NumberFormatOptionsCurrencySign = 'standard' | 'accounting';
|
||||
export declare type NumberFormatOptionsNotation = NumberFormatNotation;
|
||||
export declare type NumberFormatOptionsSignDisplay = 'auto' | 'always' | 'never' | 'exceptZero';
|
||||
export declare type NumberFormatOptionsUnitDisplay = 'long' | 'short' | 'narrow';
|
||||
export interface NumberFormatInternal extends NumberFormatDigitInternalSlots {
|
||||
locale: string;
|
||||
dataLocale: string;
|
||||
style: NumberFormatOptionsStyle;
|
||||
currency?: string;
|
||||
currencyDisplay: NumberFormatOptionsCurrencyDisplay;
|
||||
unit?: string;
|
||||
unitDisplay: NumberFormatOptionsUnitDisplay;
|
||||
currencySign: NumberFormatOptionsCurrencySign;
|
||||
notation: NumberFormatOptionsNotation;
|
||||
compactDisplay: NumberFormatOptionsCompactDisplay;
|
||||
signDisplay: NumberFormatOptionsSignDisplay;
|
||||
useGrouping: boolean;
|
||||
pl: Intl.PluralRules;
|
||||
boundFormat?: Intl.NumberFormat['format'];
|
||||
numberingSystem: string;
|
||||
dataLocaleData: NumberFormatLocaleInternalData;
|
||||
}
|
||||
export declare type NumberFormatOptions = Omit<Intl.NumberFormatOptions, 'signDisplay'> & NumberFormatDigitOptions & {
|
||||
localeMatcher?: NumberFormatOptionsLocaleMatcher;
|
||||
style?: NumberFormatOptionsStyle;
|
||||
compactDisplay?: NumberFormatOptionsCompactDisplay;
|
||||
currencyDisplay?: NumberFormatOptionsCurrencyDisplay;
|
||||
currencySign?: NumberFormatOptionsCurrencySign;
|
||||
notation?: NumberFormatOptionsNotation;
|
||||
signDisplay?: NumberFormatOptionsSignDisplay;
|
||||
unit?: string;
|
||||
unitDisplay?: NumberFormatOptionsUnitDisplay;
|
||||
numberingSystem?: string;
|
||||
trailingZeroDisplay?: 'auto' | 'stripIfInteger';
|
||||
roundingPriority?: 'auto' | 'morePrecision' | 'lessPrecision';
|
||||
};
|
||||
export declare type ResolvedNumberFormatOptions = Intl.ResolvedNumberFormatOptions & Pick<NumberFormatInternal, 'currencySign' | 'unit' | 'unitDisplay' | 'notation' | 'compactDisplay' | 'signDisplay'>;
|
||||
export declare type NumberFormatPartTypes = Intl.NumberFormatPartTypes | 'exponentSeparator' | 'exponentMinusSign' | 'exponentInteger' | 'compact' | 'unit' | 'literal';
|
||||
export interface NumberFormatPart {
|
||||
type: NumberFormatPartTypes;
|
||||
value: string;
|
||||
}
|
||||
//# sourceMappingURL=number.d.ts.map
|
||||
Reference in New Issue
Block a user