chore: update versions
This commit is contained in:
parent
ab34c981cc
commit
ed51a3b525
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
"@matthiesenxyz/astro-ghostcms-rendercontent": patch
|
||||
---
|
||||
|
||||
Bump astro from 4.0.0 to 4.3.7
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
"@matthiesenxyz/astro-ghostcms-brutalbyelian": patch
|
||||
---
|
||||
|
||||
Bump @unocss/reset from 0.57.7 to 0.58.5
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
"@matthiesenxyz/astro-ghostcms-brutalbyelian": patch
|
||||
"@matthiesenxyz/astro-ghostcms-rendercontent": patch
|
||||
"@matthiesenxyz/astro-ghostcms-catppuccin": patch
|
||||
"@matthiesenxyz/create-astro-ghostcms": patch
|
||||
"@matthiesenxyz/astro-ghostcms": patch
|
||||
---
|
||||
|
||||
Depencency updates
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
"@matthiesenxyz/astro-ghostcms-catppuccin": patch
|
||||
---
|
||||
|
||||
Bump astro-navbar from 2.3.0 to 2.3.1
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
"@matthiesenxyz/astro-ghostcms": patch
|
||||
---
|
||||
|
||||
Bump astro from 4.0.0 to 4.3.7
|
|
@ -0,0 +1 @@
|
|||
//registry.npmjs.org/:_authToken=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
|
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
var testArray = function testArray(t, actual, expected, msg) {
|
||||
t.deepEqual(actual, expected, msg);
|
||||
t.equal(actual.length, expected.length, 'expected ' + expected.length + ', got ' + actual.length);
|
||||
};
|
||||
|
||||
module.exports = function (flat, t) {
|
||||
t.test('flattens', function (st) {
|
||||
testArray(st, flat([1, [2], [[3]], [[['four']]]]), [1, 2, [3], [['four']]], 'missing depth only flattens 1 deep');
|
||||
|
||||
testArray(st, flat([1, [2], [[3]], [[['four']]]], 1), [1, 2, [3], [['four']]], 'depth of 1 only flattens 1 deep');
|
||||
st.notDeepEqual(flat([1, [2], [[3]], [[['four']]]], 1), [1, 2, 3, ['four']], 'depth of 1 only flattens 1 deep: sanity check');
|
||||
|
||||
testArray(st, flat([1, [2], [[3]], [[['four']]]], 2), [1, 2, 3, ['four']], 'depth of 2 only flattens 2 deep');
|
||||
st.notDeepEqual(flat([1, [2], [[3]], [[['four']]]], 2), [1, 2, 3, 'four'], 'depth of 2 only flattens 2 deep: sanity check');
|
||||
|
||||
testArray(st, flat([1, [2], [[3]], [[['four']]]], 3), [1, 2, 3, 'four'], 'depth of 3 only flattens 3 deep');
|
||||
testArray(st, flat([1, [2], [[3]], [[['four']]]], Infinity), [1, 2, 3, 'four'], 'depth of Infinity flattens all the way');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sparse arrays', function (st) {
|
||||
// eslint-disable-next-line no-sparse-arrays
|
||||
st.deepEqual(flat([, [1]]), flat([[], [1]]), 'an array hole is treated the same as an empty array');
|
||||
|
||||
st.end();
|
||||
});
|
||||
};
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,38 @@
|
|||
import {toString} from 'nlcst-to-string'
|
||||
import {modifyChildren} from 'unist-util-modify-children'
|
||||
|
||||
// Closing or final punctuation, or terminal markers that should still be
|
||||
// included in the previous sentence, even though they follow the sentence’s
|
||||
// terminal marker.
|
||||
import {affixSymbol} from '../expressions.js'
|
||||
|
||||
// Move certain punctuation following a terminal marker (thus in the next
|
||||
// sentence) to the previous sentence.
|
||||
export const mergeAffixSymbol = modifyChildren(function (child, index, parent) {
|
||||
const children = child.children
|
||||
|
||||
if (children && children.length > 0 && index > 0) {
|
||||
const first = children[0]
|
||||
const second = children[1]
|
||||
const previous = parent.children[index - 1]
|
||||
|
||||
if (
|
||||
(first.type === 'SymbolNode' || first.type === 'PunctuationNode') &&
|
||||
affixSymbol.test(toString(first))
|
||||
) {
|
||||
previous.children.push(children.shift())
|
||||
|
||||
// Update position.
|
||||
if (first.position && previous.position) {
|
||||
previous.position.end = first.position.end
|
||||
}
|
||||
|
||||
if (second && second.position && child.position) {
|
||||
child.position.start = second.position.start
|
||||
}
|
||||
|
||||
// Next, iterate over the previous node again.
|
||||
return index - 1
|
||||
}
|
||||
}
|
||||
})
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,416 @@
|
|||
import process from 'node:process';
|
||||
import chalk from 'chalk';
|
||||
import cliCursor from 'cli-cursor';
|
||||
import cliSpinners from 'cli-spinners';
|
||||
import logSymbols from 'log-symbols';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import stringWidth from 'string-width';
|
||||
import isInteractive from 'is-interactive';
|
||||
import isUnicodeSupported from 'is-unicode-supported';
|
||||
import stdinDiscarder from 'stdin-discarder';
|
||||
|
||||
class Ora {
|
||||
#linesToClear = 0;
|
||||
#isDiscardingStdin = false;
|
||||
#lineCount = 0;
|
||||
#frameIndex = 0;
|
||||
#options;
|
||||
#spinner;
|
||||
#stream;
|
||||
#id;
|
||||
#initialInterval;
|
||||
#isEnabled;
|
||||
#isSilent;
|
||||
#indent;
|
||||
#text;
|
||||
#prefixText;
|
||||
#suffixText;
|
||||
|
||||
color;
|
||||
|
||||
constructor(options) {
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
text: options,
|
||||
};
|
||||
}
|
||||
|
||||
this.#options = {
|
||||
color: 'cyan',
|
||||
stream: process.stderr,
|
||||
discardStdin: true,
|
||||
hideCursor: true,
|
||||
...options,
|
||||
};
|
||||
|
||||
// Public
|
||||
this.color = this.#options.color;
|
||||
|
||||
// It's important that these use the public setters.
|
||||
this.spinner = this.#options.spinner;
|
||||
|
||||
this.#initialInterval = this.#options.interval;
|
||||
this.#stream = this.#options.stream;
|
||||
this.#isEnabled = typeof this.#options.isEnabled === 'boolean' ? this.#options.isEnabled : isInteractive({stream: this.#stream});
|
||||
this.#isSilent = typeof this.#options.isSilent === 'boolean' ? this.#options.isSilent : false;
|
||||
|
||||
// Set *after* `this.#stream`.
|
||||
// It's important that these use the public setters.
|
||||
this.text = this.#options.text;
|
||||
this.prefixText = this.#options.prefixText;
|
||||
this.suffixText = this.#options.suffixText;
|
||||
this.indent = this.#options.indent;
|
||||
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
this._stream = this.#stream;
|
||||
this._isEnabled = this.#isEnabled;
|
||||
|
||||
Object.defineProperty(this, '_linesToClear', {
|
||||
get() {
|
||||
return this.#linesToClear;
|
||||
},
|
||||
set(newValue) {
|
||||
this.#linesToClear = newValue;
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(this, '_frameIndex', {
|
||||
get() {
|
||||
return this.#frameIndex;
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(this, '_lineCount', {
|
||||
get() {
|
||||
return this.#lineCount;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
get indent() {
|
||||
return this.#indent;
|
||||
}
|
||||
|
||||
set indent(indent = 0) {
|
||||
if (!(indent >= 0 && Number.isInteger(indent))) {
|
||||
throw new Error('The `indent` option must be an integer from 0 and up');
|
||||
}
|
||||
|
||||
this.#indent = indent;
|
||||
this.#updateLineCount();
|
||||
}
|
||||
|
||||
get interval() {
|
||||
return this.#initialInterval ?? this.#spinner.interval ?? 100;
|
||||
}
|
||||
|
||||
get spinner() {
|
||||
return this.#spinner;
|
||||
}
|
||||
|
||||
set spinner(spinner) {
|
||||
this.#frameIndex = 0;
|
||||
this.#initialInterval = undefined;
|
||||
|
||||
if (typeof spinner === 'object') {
|
||||
if (spinner.frames === undefined) {
|
||||
throw new Error('The given spinner must have a `frames` property');
|
||||
}
|
||||
|
||||
this.#spinner = spinner;
|
||||
} else if (!isUnicodeSupported()) {
|
||||
this.#spinner = cliSpinners.line;
|
||||
} else if (spinner === undefined) {
|
||||
// Set default spinner
|
||||
this.#spinner = cliSpinners.dots;
|
||||
} else if (spinner !== 'default' && cliSpinners[spinner]) {
|
||||
this.#spinner = cliSpinners[spinner];
|
||||
} else {
|
||||
throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);
|
||||
}
|
||||
}
|
||||
|
||||
get text() {
|
||||
return this.#text;
|
||||
}
|
||||
|
||||
set text(value = '') {
|
||||
this.#text = value;
|
||||
this.#updateLineCount();
|
||||
}
|
||||
|
||||
get prefixText() {
|
||||
return this.#prefixText;
|
||||
}
|
||||
|
||||
set prefixText(value = '') {
|
||||
this.#prefixText = value;
|
||||
this.#updateLineCount();
|
||||
}
|
||||
|
||||
get suffixText() {
|
||||
return this.#suffixText;
|
||||
}
|
||||
|
||||
set suffixText(value = '') {
|
||||
this.#suffixText = value;
|
||||
this.#updateLineCount();
|
||||
}
|
||||
|
||||
get isSpinning() {
|
||||
return this.#id !== undefined;
|
||||
}
|
||||
|
||||
#getFullPrefixText(prefixText = this.#prefixText, postfix = ' ') {
|
||||
if (typeof prefixText === 'string' && prefixText !== '') {
|
||||
return prefixText + postfix;
|
||||
}
|
||||
|
||||
if (typeof prefixText === 'function') {
|
||||
return prefixText() + postfix;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
#getFullSuffixText(suffixText = this.#suffixText, prefix = ' ') {
|
||||
if (typeof suffixText === 'string' && suffixText !== '') {
|
||||
return prefix + suffixText;
|
||||
}
|
||||
|
||||
if (typeof suffixText === 'function') {
|
||||
return prefix + suffixText();
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
#updateLineCount() {
|
||||
const columns = this.#stream.columns ?? 80;
|
||||
const fullPrefixText = this.#getFullPrefixText(this.#prefixText, '-');
|
||||
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, '-');
|
||||
const fullText = ' '.repeat(this.#indent) + fullPrefixText + '--' + this.#text + '--' + fullSuffixText;
|
||||
|
||||
this.#lineCount = 0;
|
||||
for (const line of stripAnsi(fullText).split('\n')) {
|
||||
this.#lineCount += Math.max(1, Math.ceil(stringWidth(line, {countAnsiEscapeCodes: true}) / columns));
|
||||
}
|
||||
}
|
||||
|
||||
get isEnabled() {
|
||||
return this.#isEnabled && !this.#isSilent;
|
||||
}
|
||||
|
||||
set isEnabled(value) {
|
||||
if (typeof value !== 'boolean') {
|
||||
throw new TypeError('The `isEnabled` option must be a boolean');
|
||||
}
|
||||
|
||||
this.#isEnabled = value;
|
||||
}
|
||||
|
||||
get isSilent() {
|
||||
return this.#isSilent;
|
||||
}
|
||||
|
||||
set isSilent(value) {
|
||||
if (typeof value !== 'boolean') {
|
||||
throw new TypeError('The `isSilent` option must be a boolean');
|
||||
}
|
||||
|
||||
this.#isSilent = value;
|
||||
}
|
||||
|
||||
frame() {
|
||||
const {frames} = this.#spinner;
|
||||
let frame = frames[this.#frameIndex];
|
||||
|
||||
if (this.color) {
|
||||
frame = chalk[this.color](frame);
|
||||
}
|
||||
|
||||
this.#frameIndex = ++this.#frameIndex % frames.length;
|
||||
const fullPrefixText = (typeof this.#prefixText === 'string' && this.#prefixText !== '') ? this.#prefixText + ' ' : '';
|
||||
const fullText = typeof this.text === 'string' ? ' ' + this.text : '';
|
||||
const fullSuffixText = (typeof this.#suffixText === 'string' && this.#suffixText !== '') ? ' ' + this.#suffixText : '';
|
||||
|
||||
return fullPrefixText + frame + fullText + fullSuffixText;
|
||||
}
|
||||
|
||||
clear() {
|
||||
if (!this.#isEnabled || !this.#stream.isTTY) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this.#stream.cursorTo(0);
|
||||
|
||||
for (let index = 0; index < this.#linesToClear; index++) {
|
||||
if (index > 0) {
|
||||
this.#stream.moveCursor(0, -1);
|
||||
}
|
||||
|
||||
this.#stream.clearLine(1);
|
||||
}
|
||||
|
||||
if (this.#indent || this.lastIndent !== this.#indent) {
|
||||
this.#stream.cursorTo(this.#indent);
|
||||
}
|
||||
|
||||
this.lastIndent = this.#indent;
|
||||
this.#linesToClear = 0;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.#isSilent) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this.clear();
|
||||
this.#stream.write(this.frame());
|
||||
this.#linesToClear = this.#lineCount;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
start(text) {
|
||||
if (text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
if (this.#isSilent) {
|
||||
return this;
|
||||
}
|
||||
|
||||
if (!this.#isEnabled) {
|
||||
if (this.text) {
|
||||
this.#stream.write(`- ${this.text}\n`);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
if (this.isSpinning) {
|
||||
return this;
|
||||
}
|
||||
|
||||
if (this.#options.hideCursor) {
|
||||
cliCursor.hide(this.#stream);
|
||||
}
|
||||
|
||||
if (this.#options.discardStdin && process.stdin.isTTY) {
|
||||
this.#isDiscardingStdin = true;
|
||||
stdinDiscarder.start();
|
||||
}
|
||||
|
||||
this.render();
|
||||
this.#id = setInterval(this.render.bind(this), this.interval);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
stop() {
|
||||
if (!this.#isEnabled) {
|
||||
return this;
|
||||
}
|
||||
|
||||
clearInterval(this.#id);
|
||||
this.#id = undefined;
|
||||
this.#frameIndex = 0;
|
||||
this.clear();
|
||||
if (this.#options.hideCursor) {
|
||||
cliCursor.show(this.#stream);
|
||||
}
|
||||
|
||||
if (this.#options.discardStdin && process.stdin.isTTY && this.#isDiscardingStdin) {
|
||||
stdinDiscarder.stop();
|
||||
this.#isDiscardingStdin = false;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
succeed(text) {
|
||||
return this.stopAndPersist({symbol: logSymbols.success, text});
|
||||
}
|
||||
|
||||
fail(text) {
|
||||
return this.stopAndPersist({symbol: logSymbols.error, text});
|
||||
}
|
||||
|
||||
warn(text) {
|
||||
return this.stopAndPersist({symbol: logSymbols.warning, text});
|
||||
}
|
||||
|
||||
info(text) {
|
||||
return this.stopAndPersist({symbol: logSymbols.info, text});
|
||||
}
|
||||
|
||||
stopAndPersist(options = {}) {
|
||||
if (this.#isSilent) {
|
||||
return this;
|
||||
}
|
||||
|
||||
const prefixText = options.prefixText ?? this.#prefixText;
|
||||
const fullPrefixText = this.#getFullPrefixText(prefixText, ' ');
|
||||
|
||||
const symbolText = options.symbol ?? ' ';
|
||||
|
||||
const text = options.text ?? this.text;
|
||||
const fullText = (typeof text === 'string') ? ' ' + text : '';
|
||||
|
||||
const suffixText = options.suffixText ?? this.#suffixText;
|
||||
const fullSuffixText = this.#getFullSuffixText(suffixText, ' ');
|
||||
|
||||
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + '\n';
|
||||
|
||||
this.stop();
|
||||
this.#stream.write(textToWrite);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
export default function ora(options) {
|
||||
return new Ora(options);
|
||||
}
|
||||
|
||||
export async function oraPromise(action, options) {
|
||||
const actionIsFunction = typeof action === 'function';
|
||||
const actionIsPromise = typeof action.then === 'function';
|
||||
|
||||
if (!actionIsFunction && !actionIsPromise) {
|
||||
throw new TypeError('Parameter `action` must be a Function or a Promise');
|
||||
}
|
||||
|
||||
const {successText, failText} = typeof options === 'object'
|
||||
? options
|
||||
: {successText: undefined, failText: undefined};
|
||||
|
||||
const spinner = ora(options).start();
|
||||
|
||||
try {
|
||||
const promise = actionIsFunction ? action(spinner) : action;
|
||||
const result = await promise;
|
||||
|
||||
spinner.succeed(
|
||||
successText === undefined
|
||||
? undefined
|
||||
: (typeof successText === 'string' ? successText : successText(result)),
|
||||
);
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
spinner.fail(
|
||||
failText === undefined
|
||||
? undefined
|
||||
: (typeof failText === 'string' ? failText : failText(error)),
|
||||
);
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export {default as spinners} from 'cli-spinners';
|
|
@ -0,0 +1,220 @@
|
|||
// These types are not exported, and are only used internally
|
||||
|
||||
/**
|
||||
* Take in an unknown value and return one that is of type T
|
||||
*/
|
||||
type Converter<T> = (object: unknown) => T
|
||||
|
||||
type SequenceConverter<T> = (object: unknown) => T[]
|
||||
|
||||
type RecordConverter<K extends string, V> = (object: unknown) => Record<K, V>
|
||||
|
||||
interface ConvertToIntOpts {
|
||||
clamp?: boolean
|
||||
enforceRange?: boolean
|
||||
}
|
||||
|
||||
interface WebidlErrors {
|
||||
exception (opts: { header: string, message: string }): TypeError
|
||||
/**
|
||||
* @description Throw an error when conversion from one type to another has failed
|
||||
*/
|
||||
conversionFailed (opts: {
|
||||
prefix: string
|
||||
argument: string
|
||||
types: string[]
|
||||
}): TypeError
|
||||
/**
|
||||
* @description Throw an error when an invalid argument is provided
|
||||
*/
|
||||
invalidArgument (opts: {
|
||||
prefix: string
|
||||
value: string
|
||||
type: string
|
||||
}): TypeError
|
||||
}
|
||||
|
||||
interface WebidlUtil {
|
||||
/**
|
||||
* @see https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values
|
||||
*/
|
||||
Type (object: unknown):
|
||||
| 'Undefined'
|
||||
| 'Boolean'
|
||||
| 'String'
|
||||
| 'Symbol'
|
||||
| 'Number'
|
||||
| 'BigInt'
|
||||
| 'Null'
|
||||
| 'Object'
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#abstract-opdef-converttoint
|
||||
*/
|
||||
ConvertToInt (
|
||||
V: unknown,
|
||||
bitLength: number,
|
||||
signedness: 'signed' | 'unsigned',
|
||||
opts?: ConvertToIntOpts
|
||||
): number
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#abstract-opdef-converttoint
|
||||
*/
|
||||
IntegerPart (N: number): number
|
||||
}
|
||||
|
||||
interface WebidlConverters {
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-DOMString
|
||||
*/
|
||||
DOMString (V: unknown, opts?: {
|
||||
legacyNullToEmptyString: boolean
|
||||
}): string
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-ByteString
|
||||
*/
|
||||
ByteString (V: unknown): string
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-USVString
|
||||
*/
|
||||
USVString (V: unknown): string
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-boolean
|
||||
*/
|
||||
boolean (V: unknown): boolean
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-any
|
||||
*/
|
||||
any <Value>(V: Value): Value
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-long-long
|
||||
*/
|
||||
['long long'] (V: unknown): number
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-unsigned-long-long
|
||||
*/
|
||||
['unsigned long long'] (V: unknown): number
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-unsigned-long
|
||||
*/
|
||||
['unsigned long'] (V: unknown): number
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-unsigned-short
|
||||
*/
|
||||
['unsigned short'] (V: unknown, opts?: ConvertToIntOpts): number
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#idl-ArrayBuffer
|
||||
*/
|
||||
ArrayBuffer (V: unknown): ArrayBufferLike
|
||||
ArrayBuffer (V: unknown, opts: { allowShared: false }): ArrayBuffer
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-buffer-source-types
|
||||
*/
|
||||
TypedArray (
|
||||
V: unknown,
|
||||
TypedArray: NodeJS.TypedArray | ArrayBufferLike
|
||||
): NodeJS.TypedArray | ArrayBufferLike
|
||||
TypedArray (
|
||||
V: unknown,
|
||||
TypedArray: NodeJS.TypedArray | ArrayBufferLike,
|
||||
opts?: { allowShared: false }
|
||||
): NodeJS.TypedArray | ArrayBuffer
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-buffer-source-types
|
||||
*/
|
||||
DataView (V: unknown, opts?: { allowShared: boolean }): DataView
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#BufferSource
|
||||
*/
|
||||
BufferSource (
|
||||
V: unknown,
|
||||
opts?: { allowShared: boolean }
|
||||
): NodeJS.TypedArray | ArrayBufferLike | DataView
|
||||
|
||||
['sequence<ByteString>']: SequenceConverter<string>
|
||||
|
||||
['sequence<sequence<ByteString>>']: SequenceConverter<string[]>
|
||||
|
||||
['record<ByteString, ByteString>']: RecordConverter<string, string>
|
||||
|
||||
[Key: string]: (...args: any[]) => unknown
|
||||
}
|
||||
|
||||
export interface Webidl {
|
||||
errors: WebidlErrors
|
||||
util: WebidlUtil
|
||||
converters: WebidlConverters
|
||||
|
||||
/**
|
||||
* @description Performs a brand-check on {@param V} to ensure it is a
|
||||
* {@param cls} object.
|
||||
*/
|
||||
brandCheck <Interface>(V: unknown, cls: Interface, opts?: { strict?: boolean }): asserts V is Interface
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-sequence
|
||||
* @description Convert a value, V, to a WebIDL sequence type.
|
||||
*/
|
||||
sequenceConverter <Type>(C: Converter<Type>): SequenceConverter<Type>
|
||||
|
||||
illegalConstructor (): never
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#es-to-record
|
||||
* @description Convert a value, V, to a WebIDL record type.
|
||||
*/
|
||||
recordConverter <K extends string, V>(
|
||||
keyConverter: Converter<K>,
|
||||
valueConverter: Converter<V>
|
||||
): RecordConverter<K, V>
|
||||
|
||||
/**
|
||||
* Similar to {@link Webidl.brandCheck} but allows skipping the check if third party
|
||||
* interfaces are allowed.
|
||||
*/
|
||||
interfaceConverter <Interface>(cls: Interface): (
|
||||
V: unknown,
|
||||
opts?: { strict: boolean }
|
||||
) => asserts V is typeof cls
|
||||
|
||||
// TODO(@KhafraDev): a type could likely be implemented that can infer the return type
|
||||
// from the converters given?
|
||||
/**
|
||||
* Converts a value, V, to a WebIDL dictionary types. Allows limiting which keys are
|
||||
* allowed, values allowed, optional and required keys. Auto converts the value to
|
||||
* a type given a converter.
|
||||
*/
|
||||
dictionaryConverter (converters: {
|
||||
key: string,
|
||||
defaultValue?: unknown,
|
||||
required?: boolean,
|
||||
converter: (...args: unknown[]) => unknown,
|
||||
allowedValues?: unknown[]
|
||||
}[]): (V: unknown) => Record<string, unknown>
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#idl-nullable-type
|
||||
* @description allows a type, V, to be null
|
||||
*/
|
||||
nullableConverter <T>(
|
||||
converter: Converter<T>
|
||||
): (V: unknown) => ReturnType<typeof converter> | null
|
||||
|
||||
argumentLengthCheck (args: { length: number }, min: number, context: {
|
||||
header: string
|
||||
message?: string
|
||||
}): void
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{"files":{"LICENSE":{"checkedAt":1707919831712,"integrity":"sha512-HQaIQk9pwOcyKutyDk4o2a87WnotwYuLGYFW43emGm4FvIJFKPyg+OYaw5sTegKAKf+C5SKa1ACjzCLivbaHrQ==","mode":420,"size":1141},"README.md":{"checkedAt":1707919832332,"integrity":"sha512-hmeohqsWqvEp2krMX6HUSBOWH+otvPY6d9nmJ+zqyBklhi09Y7bmm+9TKRq8UnoPlyp1l/GDui7Np6iMNY7FNA==","mode":420,"size":622},"index.d.ts":{"checkedAt":1707919832332,"integrity":"sha512-FEAP4/N8lWETGOG6uOzk188VcikGeOv21aurF8SsUV5Unc8aZn5KASa/+2FhIjRYPbKCdvNTXPvOk4oRAIHWIg==","mode":420,"size":4335},"package.json":{"checkedAt":1707919832332,"integrity":"sha512-YebQXVNHhGIcXiHowbgdNlmV6g+BoNZ66wSKYgFOi6YVyDr2ze98Awklvj916upjdaE5DpuHqptkLZzV5VicnA==","mode":420,"size":1151}}}
|
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag.
|
||||
|
||||
@param flag - CLI flag to look for. The `--` prefix is optional.
|
||||
@param argv - CLI arguments. Default: `process.argv`.
|
||||
@returns Whether the flag exists.
|
||||
|
||||
@example
|
||||
```
|
||||
// $ ts-node foo.ts -f --unicorn --foo=bar -- --rainbow
|
||||
|
||||
// foo.ts
|
||||
import hasFlag = require('has-flag');
|
||||
|
||||
hasFlag('unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('--unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('f');
|
||||
//=> true
|
||||
|
||||
hasFlag('-f');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo=bar');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo');
|
||||
//=> false
|
||||
|
||||
hasFlag('rainbow');
|
||||
//=> false
|
||||
```
|
||||
*/
|
||||
declare function hasFlag(flag: string, argv?: string[]): boolean;
|
||||
|
||||
export = hasFlag;
|
|
@ -0,0 +1,5 @@
|
|||
export { toHtml } from "./lib/index.js";
|
||||
export type CharacterReferences = import('./lib/index.js').CharacterReferences;
|
||||
export type Options = import('./lib/index.js').Options;
|
||||
export type Quote = import('./lib/index.js').Quote;
|
||||
export type Space = import('./lib/index.js').Space;
|
|
@ -0,0 +1,36 @@
|
|||
'use strict';
|
||||
|
||||
require('../auto');
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
var test = require('tape');
|
||||
var defineProperties = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
|
||||
test('shimmed', function (t) {
|
||||
t.equal(String.prototype.trimEnd.length, 0, 'String#trimEnd has a length of 0');
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal((/^(?:trimRight|trimEnd)$/).test(String.prototype.trimEnd.name), true, 'String#trimEnd has name "trimRight" or "trimEnd"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(String.prototype, 'trimEnd'), 'String#trimEnd is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
var supportsStrictMode = (function () { return typeof this === 'undefined'; }());
|
||||
|
||||
t.test('bad string/this value', { skip: !supportsStrictMode }, function (st) {
|
||||
st['throws'](function () { return String.prototype.trimEnd.call(undefined, 'a'); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { return String.prototype.trimEnd.call(null, 'a'); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(callBind(String.prototype.trimEnd), t);
|
||||
|
||||
t.end();
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
Prism.languages.lua = {
|
||||
'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,
|
||||
// \z may be used to skip the following space
|
||||
'string': {
|
||||
pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,
|
||||
greedy: true
|
||||
},
|
||||
'number': /\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,
|
||||
'keyword': /\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,
|
||||
'function': /(?!\d)\w+(?=\s*(?:[({]))/,
|
||||
'operator': [
|
||||
/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,
|
||||
{
|
||||
// Match ".." but don't break "..."
|
||||
pattern: /(^|[^.])\.\.(?!\.)/,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'punctuation': /[\[\](){},;]|\.+|:+/
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,65 @@
|
|||
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
||||
|
||||
const codes = new Uint8Array(256)
|
||||
|
||||
for (let i = 0; i < alphabet.length; i++) {
|
||||
codes[alphabet.charCodeAt(i)] = i
|
||||
}
|
||||
|
||||
codes[/* - */ 0x2d] = 62
|
||||
codes[/* _ */ 0x5f] = 63
|
||||
|
||||
function byteLength (string) {
|
||||
let len = string.length
|
||||
|
||||
if (string.charCodeAt(len - 1) === 0x3d) len--
|
||||
if (len > 1 && string.charCodeAt(len - 1) === 0x3d) len--
|
||||
|
||||
return (len * 3) >>> 2
|
||||
}
|
||||
|
||||
function toString (buffer) {
|
||||
const len = buffer.byteLength
|
||||
|
||||
let result = ''
|
||||
|
||||
for (let i = 0; i < len; i += 3) {
|
||||
result += (
|
||||
alphabet[buffer[i] >> 2] +
|
||||
alphabet[((buffer[i] & 3) << 4) | (buffer[i + 1] >> 4)] +
|
||||
alphabet[((buffer[i + 1] & 15) << 2) | (buffer[i + 2] >> 6)] +
|
||||
alphabet[buffer[i + 2] & 63]
|
||||
)
|
||||
}
|
||||
|
||||
if (len % 3 === 2) {
|
||||
result = result.substring(0, result.length - 1) + '='
|
||||
} else if (len % 3 === 1) {
|
||||
result = result.substring(0, result.length - 2) + '=='
|
||||
}
|
||||
|
||||
return result
|
||||
};
|
||||
|
||||
function write (buffer, string, offset = 0, length = byteLength(string)) {
|
||||
const len = Math.min(length, buffer.byteLength - offset)
|
||||
|
||||
for (let i = 0, j = 0; j < len; i += 4) {
|
||||
const a = codes[string.charCodeAt(i)]
|
||||
const b = codes[string.charCodeAt(i + 1)]
|
||||
const c = codes[string.charCodeAt(i + 2)]
|
||||
const d = codes[string.charCodeAt(i + 3)]
|
||||
|
||||
buffer[j++] = (a << 2) | (b >> 4)
|
||||
buffer[j++] = ((b & 15) << 4) | (c >> 2)
|
||||
buffer[j++] = ((c & 3) << 6) | (d & 63)
|
||||
}
|
||||
|
||||
return len
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
byteLength,
|
||||
toString,
|
||||
write
|
||||
}
|
|
@ -0,0 +1,388 @@
|
|||
import { bold } from "kleur/colors";
|
||||
import fs from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { buildClientDirectiveEntrypoint } from "../core/client-directive/index.js";
|
||||
import { mergeConfig } from "../core/config/index.js";
|
||||
import { isServerLikeOutput } from "../prerender/utils.js";
|
||||
import { validateSupportedFeatures } from "./astroFeaturesValidation.js";
|
||||
async function withTakingALongTimeMsg({
|
||||
name,
|
||||
hookName,
|
||||
hookResult,
|
||||
timeoutMs = 3e3,
|
||||
logger
|
||||
}) {
|
||||
const timeout = setTimeout(() => {
|
||||
logger.info(
|
||||
"build",
|
||||
`Waiting for integration ${bold(JSON.stringify(name))}, hook ${bold(
|
||||
JSON.stringify(hookName)
|
||||
)}...`
|
||||
);
|
||||
}, timeoutMs);
|
||||
const result = await hookResult;
|
||||
clearTimeout(timeout);
|
||||
return result;
|
||||
}
|
||||
const Loggers = /* @__PURE__ */ new WeakMap();
|
||||
function getLogger(integration, logger) {
|
||||
if (Loggers.has(integration)) {
|
||||
return Loggers.get(integration);
|
||||
}
|
||||
const integrationLogger = logger.forkIntegrationLogger(integration.name);
|
||||
Loggers.set(integration, integrationLogger);
|
||||
return integrationLogger;
|
||||
}
|
||||
async function runHookConfigSetup({
|
||||
settings,
|
||||
command,
|
||||
logger,
|
||||
isRestart = false
|
||||
}) {
|
||||
if (settings.config.adapter) {
|
||||
settings.config.integrations.push(settings.config.adapter);
|
||||
}
|
||||
let updatedConfig = { ...settings.config };
|
||||
let updatedSettings = { ...settings, config: updatedConfig };
|
||||
let addedClientDirectives = /* @__PURE__ */ new Map();
|
||||
let astroJSXRenderer = null;
|
||||
for (let i = 0; i < updatedConfig.integrations.length; i++) {
|
||||
const integration = updatedConfig.integrations[i];
|
||||
if (integration.hooks?.["astro:config:setup"]) {
|
||||
let addPageExtension2 = function(...input) {
|
||||
const exts = input.flat(Infinity).map((ext) => `.${ext.replace(/^\./, "")}`);
|
||||
updatedSettings.pageExtensions.push(...exts);
|
||||
}, addContentEntryType2 = function(contentEntryType) {
|
||||
updatedSettings.contentEntryTypes.push(contentEntryType);
|
||||
}, addDataEntryType2 = function(dataEntryType) {
|
||||
updatedSettings.dataEntryTypes.push(dataEntryType);
|
||||
};
|
||||
var addPageExtension = addPageExtension2, addContentEntryType = addContentEntryType2, addDataEntryType = addDataEntryType2;
|
||||
const integrationLogger = getLogger(integration, logger);
|
||||
const hooks = {
|
||||
config: updatedConfig,
|
||||
command,
|
||||
isRestart,
|
||||
addRenderer(renderer) {
|
||||
if (!renderer.name) {
|
||||
throw new Error(`Integration ${bold(integration.name)} has an unnamed renderer.`);
|
||||
}
|
||||
if (!renderer.serverEntrypoint) {
|
||||
throw new Error(`Renderer ${bold(renderer.name)} does not provide a serverEntrypoint.`);
|
||||
}
|
||||
if (renderer.name === "astro:jsx") {
|
||||
astroJSXRenderer = renderer;
|
||||
} else {
|
||||
updatedSettings.renderers.push(renderer);
|
||||
}
|
||||
},
|
||||
injectScript: (stage, content) => {
|
||||
updatedSettings.scripts.push({ stage, content });
|
||||
},
|
||||
updateConfig: (newConfig) => {
|
||||
updatedConfig = mergeConfig(updatedConfig, newConfig);
|
||||
return { ...updatedConfig };
|
||||
},
|
||||
injectRoute: (injectRoute) => {
|
||||
if (injectRoute.entrypoint == null && "entryPoint" in injectRoute) {
|
||||
logger.warn(
|
||||
null,
|
||||
`The injected route "${injectRoute.pattern}" by ${integration.name} specifies the entry point with the "entryPoint" property. This property is deprecated, please use "entrypoint" instead.`
|
||||
);
|
||||
injectRoute.entrypoint = injectRoute.entryPoint;
|
||||
}
|
||||
updatedSettings.injectedRoutes.push(injectRoute);
|
||||
},
|
||||
addWatchFile: (path) => {
|
||||
updatedSettings.watchFiles.push(path instanceof URL ? fileURLToPath(path) : path);
|
||||
},
|
||||
addDevOverlayPlugin: (entrypoint) => {
|
||||
hooks.addDevToolbarApp(entrypoint);
|
||||
},
|
||||
addDevToolbarApp: (entrypoint) => {
|
||||
updatedSettings.devToolbarApps.push(entrypoint);
|
||||
},
|
||||
addClientDirective: ({ name, entrypoint }) => {
|
||||
if (updatedSettings.clientDirectives.has(name) || addedClientDirectives.has(name)) {
|
||||
throw new Error(
|
||||
`The "${integration.name}" integration is trying to add the "${name}" client directive, but it already exists.`
|
||||
);
|
||||
}
|
||||
addedClientDirectives.set(name, buildClientDirectiveEntrypoint(name, entrypoint));
|
||||
},
|
||||
addMiddleware: ({ order, entrypoint }) => {
|
||||
if (typeof updatedSettings.middlewares[order] === "undefined") {
|
||||
throw new Error(
|
||||
`The "${integration.name}" integration is trying to add middleware but did not specify an order.`
|
||||
);
|
||||
}
|
||||
logger.debug(
|
||||
"middleware",
|
||||
`The integration ${integration.name} has added middleware that runs ${order === "pre" ? "before" : "after"} any application middleware you define.`
|
||||
);
|
||||
updatedSettings.middlewares[order].push(entrypoint);
|
||||
},
|
||||
logger: integrationLogger
|
||||
};
|
||||
Object.defineProperty(hooks, "addPageExtension", {
|
||||
value: addPageExtension2,
|
||||
writable: false,
|
||||
enumerable: false
|
||||
});
|
||||
Object.defineProperty(hooks, "addContentEntryType", {
|
||||
value: addContentEntryType2,
|
||||
writable: false,
|
||||
enumerable: false
|
||||
});
|
||||
Object.defineProperty(hooks, "addDataEntryType", {
|
||||
value: addDataEntryType2,
|
||||
writable: false,
|
||||
enumerable: false
|
||||
});
|
||||
await withTakingALongTimeMsg({
|
||||
name: integration.name,
|
||||
hookName: "astro:config:setup",
|
||||
hookResult: integration.hooks["astro:config:setup"](hooks),
|
||||
logger
|
||||
});
|
||||
for (const [name, compiled] of addedClientDirectives) {
|
||||
updatedSettings.clientDirectives.set(name, await compiled);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (astroJSXRenderer) {
|
||||
updatedSettings.renderers.push(astroJSXRenderer);
|
||||
}
|
||||
updatedSettings.config = updatedConfig;
|
||||
return updatedSettings;
|
||||
}
|
||||
async function runHookConfigDone({
|
||||
settings,
|
||||
logger
|
||||
}) {
|
||||
for (const integration of settings.config.integrations) {
|
||||
if (integration?.hooks?.["astro:config:done"]) {
|
||||
await withTakingALongTimeMsg({
|
||||
name: integration.name,
|
||||
hookName: "astro:config:done",
|
||||
hookResult: integration.hooks["astro:config:done"]({
|
||||
config: settings.config,
|
||||
setAdapter(adapter) {
|
||||
if (settings.adapter && settings.adapter.name !== adapter.name) {
|
||||
throw new Error(
|
||||
`Integration "${integration.name}" conflicts with "${settings.adapter.name}". You can only configure one deployment integration.`
|
||||
);
|
||||
}
|
||||
if (!adapter.supportedAstroFeatures) {
|
||||
throw new Error(
|
||||
`The adapter ${adapter.name} doesn't provide a feature map. It is required in Astro 4.0.`
|
||||
);
|
||||
} else {
|
||||
const validationResult = validateSupportedFeatures(
|
||||
adapter.name,
|
||||
adapter.supportedAstroFeatures,
|
||||
settings.config,
|
||||
// SAFETY: we checked before if it's not present, and we throw an error
|
||||
adapter.adapterFeatures,
|
||||
logger
|
||||
);
|
||||
for (const [featureName, supported] of Object.entries(validationResult)) {
|
||||
if (!supported && featureName !== "assets") {
|
||||
logger.error(
|
||||
null,
|
||||
`The adapter ${adapter.name} doesn't support the feature ${featureName}. Your project won't be built. You should not use it.`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
settings.adapter = adapter;
|
||||
},
|
||||
logger: getLogger(integration, logger)
|
||||
}),
|
||||
logger
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
async function runHookServerSetup({
|
||||
config,
|
||||
server,
|
||||
logger
|
||||
}) {
|
||||
for (const integration of config.integrations) {
|
||||
if (integration?.hooks?.["astro:server:setup"]) {
|
||||
await withTakingALongTimeMsg({
|
||||
name: integration.name,
|
||||
hookName: "astro:server:setup",
|
||||
hookResult: integration.hooks["astro:server:setup"]({
|
||||
server,
|
||||
logger: getLogger(integration, logger)
|
||||
}),
|
||||
logger
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
async function runHookServerStart({
|
||||
config,
|
||||
address,
|
||||
logger
|
||||
}) {
|
||||
for (const integration of config.integrations) {
|
||||
if (integration?.hooks?.["astro:server:start"]) {
|
||||
await withTakingALongTimeMsg({
|
||||
name: integration.name,
|
||||
hookName: "astro:server:start",
|
||||
hookResult: integration.hooks["astro:server:start"]({
|
||||
address,
|
||||
logger: getLogger(integration, logger)
|
||||
}),
|
||||
logger
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
async function runHookServerDone({
|
||||
config,
|
||||
logger
|
||||
}) {
|
||||
for (const integration of config.integrations) {
|
||||
if (integration?.hooks?.["astro:server:done"]) {
|
||||
await withTakingALongTimeMsg({
|
||||
name: integration.name,
|
||||
hookName: "astro:server:done",
|
||||
hookResult: integration.hooks["astro:server:done"]({
|
||||
logger: getLogger(integration, logger)
|
||||
}),
|
||||
logger
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
async function runHookBuildStart({
|
||||
config,
|
||||
logging
|
||||
}) {
|
||||
for (const integration of config.integrations) {
|
||||
if (integration?.hooks?.["astro:build:start"]) {
|
||||
const logger = getLogger(integration, logging);
|
||||
await withTakingALongTimeMsg({
|
||||
name: integration.name,
|
||||
hookName: "astro:build:start",
|
||||
hookResult: integration.hooks["astro:build:start"]({ logger }),
|
||||
logger: logging
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
async function runHookBuildSetup({
|
||||
config,
|
||||
vite,
|
||||
pages,
|
||||
target,
|
||||
logger
|
||||
}) {
|
||||
let updatedConfig = vite;
|
||||
for (const integration of config.integrations) {
|
||||
if (integration?.hooks?.["astro:build:setup"]) {
|
||||
await withTakingALongTimeMsg({
|
||||
name: integration.name,
|
||||
hookName: "astro:build:setup",
|
||||
hookResult: integration.hooks["astro:build:setup"]({
|
||||
vite,
|
||||
pages,
|
||||
target,
|
||||
updateConfig: (newConfig) => {
|
||||
updatedConfig = mergeConfig(updatedConfig, newConfig);
|
||||
return { ...updatedConfig };
|
||||
},
|
||||
logger: getLogger(integration, logger)
|
||||
}),
|
||||
logger
|
||||
});
|
||||
}
|
||||
}
|
||||
return updatedConfig;
|
||||
}
|
||||
async function runHookBuildSsr({
|
||||
config,
|
||||
manifest,
|
||||
logger,
|
||||
entryPoints,
|
||||
middlewareEntryPoint
|
||||
}) {
|
||||
for (const integration of config.integrations) {
|
||||
if (integration?.hooks?.["astro:build:ssr"]) {
|
||||
await withTakingALongTimeMsg({
|
||||
name: integration.name,
|
||||
hookName: "astro:build:ssr",
|
||||
hookResult: integration.hooks["astro:build:ssr"]({
|
||||
manifest,
|
||||
entryPoints,
|
||||
middlewareEntryPoint,
|
||||
logger: getLogger(integration, logger)
|
||||
}),
|
||||
logger
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
async function runHookBuildGenerated({
|
||||
config,
|
||||
logger
|
||||
}) {
|
||||
const dir = isServerLikeOutput(config) ? config.build.client : config.outDir;
|
||||
for (const integration of config.integrations) {
|
||||
if (integration?.hooks?.["astro:build:generated"]) {
|
||||
await withTakingALongTimeMsg({
|
||||
name: integration.name,
|
||||
hookName: "astro:build:generated",
|
||||
hookResult: integration.hooks["astro:build:generated"]({
|
||||
dir,
|
||||
logger: getLogger(integration, logger)
|
||||
}),
|
||||
logger
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
async function runHookBuildDone({ config, pages, routes, logging }) {
|
||||
const dir = isServerLikeOutput(config) ? config.build.client : config.outDir;
|
||||
await fs.promises.mkdir(dir, { recursive: true });
|
||||
for (const integration of config.integrations) {
|
||||
if (integration?.hooks?.["astro:build:done"]) {
|
||||
const logger = getLogger(integration, logging);
|
||||
await withTakingALongTimeMsg({
|
||||
name: integration.name,
|
||||
hookName: "astro:build:done",
|
||||
hookResult: integration.hooks["astro:build:done"]({
|
||||
pages: pages.map((p) => ({ pathname: p })),
|
||||
dir,
|
||||
routes,
|
||||
logger
|
||||
}),
|
||||
logger: logging
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
function isFunctionPerRouteEnabled(adapter) {
|
||||
if (adapter?.adapterFeatures?.functionPerRoute === true) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export {
|
||||
isFunctionPerRouteEnabled,
|
||||
runHookBuildDone,
|
||||
runHookBuildGenerated,
|
||||
runHookBuildSetup,
|
||||
runHookBuildSsr,
|
||||
runHookBuildStart,
|
||||
runHookConfigDone,
|
||||
runHookConfigSetup,
|
||||
runHookServerDone,
|
||||
runHookServerSetup,
|
||||
runHookServerStart
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const _5_0_1 = require("../5_0");
|
||||
const project_1 = require("./project");
|
||||
function default_1(ts, sys, host, createLanguageService) {
|
||||
return (0, _5_0_1.default)(ts, sys, host, createLanguageService, project_1.createProject);
|
||||
}
|
||||
exports.default = default_1;
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,36 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return negateValue;
|
||||
}
|
||||
});
|
||||
function negateValue(value) {
|
||||
value = `${value}`;
|
||||
if (value === "0") {
|
||||
return "0";
|
||||
}
|
||||
// Flip sign of numbers
|
||||
if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
|
||||
return value.replace(/^[+-]?/, (sign)=>sign === "-" ? "" : "-");
|
||||
}
|
||||
// What functions we support negating numeric values for
|
||||
// var() isn't inherently a numeric function but we support it anyway
|
||||
// The trigonometric functions are omitted because you'll need to use calc(…) with them _anyway_
|
||||
// to produce generally useful results and that will be covered already
|
||||
let numericFunctions = [
|
||||
"var",
|
||||
"calc",
|
||||
"min",
|
||||
"max",
|
||||
"clamp"
|
||||
];
|
||||
for (const fn of numericFunctions){
|
||||
if (value.includes(`${fn}(`)) {
|
||||
return `calc(${value} * -1)`;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,190 @@
|
|||
---
|
||||
description: 'Disallow certain types in boolean expressions.'
|
||||
---
|
||||
|
||||
> 🛑 This file is source code, not the primary documentation location! 🛑
|
||||
>
|
||||
> See **https://typescript-eslint.io/rules/strict-boolean-expressions** for documentation.
|
||||
|
||||
Forbids usage of non-boolean types in expressions where a boolean is expected.
|
||||
`boolean` and `never` types are always allowed.
|
||||
Additional types which are considered safe in a boolean context can be configured via options.
|
||||
|
||||
The following nodes are considered boolean expressions and their type is checked:
|
||||
|
||||
- Argument to the logical negation operator (`!arg`).
|
||||
- The condition in a conditional expression (`cond ? x : y`).
|
||||
- Conditions for `if`, `for`, `while`, and `do-while` statements.
|
||||
- Operands of logical binary operators (`lhs || rhs` and `lhs && rhs`).
|
||||
- Right-hand side operand is ignored when it's not a descendant of another boolean expression.
|
||||
This is to allow usage of boolean operators for their short-circuiting behavior.
|
||||
|
||||
## Examples
|
||||
|
||||
<!--tabs-->
|
||||
|
||||
### ❌ Incorrect
|
||||
|
||||
```ts
|
||||
// nullable numbers are considered unsafe by default
|
||||
let num: number | undefined = 0;
|
||||
if (num) {
|
||||
console.log('num is defined');
|
||||
}
|
||||
|
||||
// nullable strings are considered unsafe by default
|
||||
let str: string | null = null;
|
||||
if (!str) {
|
||||
console.log('str is empty');
|
||||
}
|
||||
|
||||
// nullable booleans are considered unsafe by default
|
||||
function foo(bool?: boolean) {
|
||||
if (bool) {
|
||||
bar();
|
||||
}
|
||||
}
|
||||
|
||||
// `any`, unconstrained generics and unions of more than one primitive type are disallowed
|
||||
const foo = <T>(arg: T) => (arg ? 1 : 0);
|
||||
|
||||
// always-truthy and always-falsy types are disallowed
|
||||
let obj = {};
|
||||
while (obj) {
|
||||
obj = getObj();
|
||||
}
|
||||
```
|
||||
|
||||
### ✅ Correct
|
||||
|
||||
```tsx
|
||||
// Using logical operator short-circuiting is allowed
|
||||
const Component = () => {
|
||||
const entry = map.get('foo') || {};
|
||||
return entry && <p>Name: {entry.name}</p>;
|
||||
};
|
||||
|
||||
// nullable values should be checked explicitly against null or undefined
|
||||
let num: number | undefined = 0;
|
||||
if (num != null) {
|
||||
console.log('num is defined');
|
||||
}
|
||||
|
||||
let str: string | null = null;
|
||||
if (str != null && !str) {
|
||||
console.log('str is empty');
|
||||
}
|
||||
|
||||
function foo(bool?: boolean) {
|
||||
if (bool ?? false) {
|
||||
bar();
|
||||
}
|
||||
}
|
||||
|
||||
// `any` types should be cast to boolean explicitly
|
||||
const foo = (arg: any) => (Boolean(arg) ? 1 : 0);
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### `allowString`
|
||||
|
||||
Allows `string` in a boolean context.
|
||||
This is safe because strings have only one falsy value (`""`).
|
||||
Set this to `false` if you prefer the explicit `str != ""` or `str.length > 0` style.
|
||||
|
||||
### `allowNumber`
|
||||
|
||||
Allows `number` in a boolean context.
|
||||
This is safe because numbers have only two falsy values (`0` and `NaN`).
|
||||
Set this to `false` if you prefer the explicit `num != 0` and `!Number.isNaN(num)` style.
|
||||
|
||||
### `allowNullableObject`
|
||||
|
||||
Allows `object | function | symbol | null | undefined` in a boolean context.
|
||||
This is safe because objects, functions and symbols don't have falsy values.
|
||||
Set this to `false` if you prefer the explicit `obj != null` style.
|
||||
|
||||
### `allowNullableBoolean`
|
||||
|
||||
Allows `boolean | null | undefined` in a boolean context.
|
||||
This is unsafe because nullable booleans can be either `false` or nullish.
|
||||
Set this to `false` if you want to enforce explicit `bool ?? false` or `bool ?? true` style.
|
||||
Set this to `true` if you don't mind implicitly treating false the same as a nullish value.
|
||||
|
||||
### `allowNullableString`
|
||||
|
||||
Allows `string | null | undefined` in a boolean context.
|
||||
This is unsafe because nullable strings can be either an empty string or nullish.
|
||||
Set this to `true` if you don't mind implicitly treating an empty string the same as a nullish value.
|
||||
|
||||
### `allowNullableNumber`
|
||||
|
||||
Allows `number | null | undefined` in a boolean context.
|
||||
This is unsafe because nullable numbers can be either a falsy number or nullish.
|
||||
Set this to `true` if you don't mind implicitly treating zero or NaN the same as a nullish value.
|
||||
|
||||
### `allowNullableEnum`
|
||||
|
||||
Allows `enum | null | undefined` in a boolean context.
|
||||
This is unsafe because nullable enums can be either a falsy number or nullish.
|
||||
Set this to `true` if you don't mind implicitly treating an enum whose value is zero the same as a nullish value.
|
||||
|
||||
### `allowAny`
|
||||
|
||||
Allows `any` in a boolean context.
|
||||
This is unsafe for obvious reasons.
|
||||
Set this to `true` at your own risk.
|
||||
|
||||
### `allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing`
|
||||
|
||||
If this is set to `false`, then the rule will error on every file whose `tsconfig.json` does _not_ have the `strictNullChecks` compiler option (or `strict`) set to `true`.
|
||||
|
||||
Without `strictNullChecks`, TypeScript essentially erases `undefined` and `null` from the types. This means when this rule inspects the types from a variable, **it will not be able to tell that the variable might be `null` or `undefined`**, which essentially makes this rule a lot less useful.
|
||||
|
||||
You should be using `strictNullChecks` to ensure complete type-safety in your codebase.
|
||||
|
||||
If for some reason you cannot turn on `strictNullChecks`, but still want to use this rule - you can use this option to allow it - but know that the behavior of this rule is _undefined_ with the compiler option turned off. We will not accept bug reports if you are using this option.
|
||||
|
||||
## Fixes and Suggestions
|
||||
|
||||
This rule provides following fixes and suggestions for particular types in boolean context:
|
||||
|
||||
- `boolean` - Always allowed - no fix needed.
|
||||
- `string` - (when `allowString` is `false`) - Provides following suggestions:
|
||||
- Change condition to check string's length (`str` → `str.length > 0`)
|
||||
- Change condition to check for empty string (`str` → `str !== ""`)
|
||||
- Explicitly cast value to a boolean (`str` → `Boolean(str)`)
|
||||
- `number` - (when `allowNumber` is `false`):
|
||||
- For `array.length` - Provides **autofix**:
|
||||
- Change condition to check for 0 (`array.length` → `array.length > 0`)
|
||||
- For other number values - Provides following suggestions:
|
||||
- Change condition to check for 0 (`num` → `num !== 0`)
|
||||
- Change condition to check for NaN (`num` → `!Number.isNaN(num)`)
|
||||
- Explicitly cast value to a boolean (`num` → `Boolean(num)`)
|
||||
- `object | null | undefined` - (when `allowNullableObject` is `false`) - Provides **autofix**:
|
||||
- Change condition to check for null/undefined (`maybeObj` → `maybeObj != null`)
|
||||
- `boolean | null | undefined` - Provides following suggestions:
|
||||
- Explicitly treat nullish value the same as false (`maybeBool` → `maybeBool ?? false`)
|
||||
- Change condition to check for true/false (`maybeBool` → `maybeBool === true`)
|
||||
- `string | null | undefined` - Provides following suggestions:
|
||||
- Change condition to check for null/undefined (`maybeStr` → `maybeStr != null`)
|
||||
- Explicitly treat nullish value the same as an empty string (`maybeStr` → `maybeStr ?? ""`)
|
||||
- Explicitly cast value to a boolean (`maybeStr` → `Boolean(maybeStr)`)
|
||||
- `number | null | undefined` - Provides following suggestions:
|
||||
- Change condition to check for null/undefined (`maybeNum` → `maybeNum != null`)
|
||||
- Explicitly treat nullish value the same as 0 (`maybeNum` → `maybeNum ?? 0`)
|
||||
- Explicitly cast value to a boolean (`maybeNum` → `Boolean(maybeNum)`)
|
||||
- `any` and `unknown` - Provides following suggestions:
|
||||
- Explicitly cast value to a boolean (`value` → `Boolean(value)`)
|
||||
|
||||
## When Not To Use It
|
||||
|
||||
If your project isn't likely to experience bugs from falsy non-boolean values being used in logical conditions, you can skip enabling this rule.
|
||||
|
||||
Otherwise, this rule can be quite strict around requiring exact comparisons in logical checks.
|
||||
If you prefer more succinct checks over more precise boolean logic, this rule might not be for you.
|
||||
|
||||
## Related To
|
||||
|
||||
- [no-unnecessary-condition](./no-unnecessary-condition.md) - Similar rule which reports always-truthy and always-falsy values in conditions
|
|
@ -0,0 +1,35 @@
|
|||
const unicode = require('../lib/unicode')
|
||||
|
||||
module.exports = {
|
||||
isSpaceSeparator (c) {
|
||||
return typeof c === 'string' && unicode.Space_Separator.test(c)
|
||||
},
|
||||
|
||||
isIdStartChar (c) {
|
||||
return typeof c === 'string' && (
|
||||
(c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
(c === '$') || (c === '_') ||
|
||||
unicode.ID_Start.test(c)
|
||||
)
|
||||
},
|
||||
|
||||
isIdContinueChar (c) {
|
||||
return typeof c === 'string' && (
|
||||
(c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
(c >= '0' && c <= '9') ||
|
||||
(c === '$') || (c === '_') ||
|
||||
(c === '\u200C') || (c === '\u200D') ||
|
||||
unicode.ID_Continue.test(c)
|
||||
)
|
||||
},
|
||||
|
||||
isDigit (c) {
|
||||
return typeof c === 'string' && /[0-9]/.test(c)
|
||||
},
|
||||
|
||||
isHexDigit (c) {
|
||||
return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
|
||||
},
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{"files":{"tslib.es6.html":{"checkedAt":1707919833832,"integrity":"sha512-aoAR2zaxE9UtcXO4kE9FbPBgIZEVk7u3Z+nEPmDo6rwcYth07KxrVZejVEdy2XmKvkkcb8O/XM9UK3bPc1iMPw==","mode":420,"size":36},"tslib.html":{"checkedAt":1707919833832,"integrity":"sha512-4dCvZ5WYJpcbIJY4RPUhOBbFud1156Rr7RphuR12/+mXKUeIpCxol2/uWL4WDFNNlSH909M2AY4fiLWJo8+fTw==","mode":420,"size":32},"modules/index.js":{"checkedAt":1707919833832,"integrity":"sha512-6uBhaW43JvLOPAHzjhQpgoIOpwdlkMiCXce6chpOZq8nQublnZBTLc7DpsNkfcim4gfRCbNxtJBWdECf5KxJIw==","mode":420,"size":1338},"tslib.es6.js":{"checkedAt":1707919833832,"integrity":"sha512-eDHLpWLh9+A6mrqTRBtJa3nNJq5crniNrv3PAtneA/hDpGd08aQ7VemX1YV6v31L/D6gHuLHriPkHq+76CnHLw==","mode":420,"size":17588},"tslib.js":{"checkedAt":1707919833833,"integrity":"sha512-95Q25zXvjJ3iSYrF/ryalUSykwNFaGqYLOPOnIVJLhsV0PpKUdAW20dSwumowVrFTRnlXJQ/UXYpJZSz96WtuA==","mode":420,"size":20563},"modules/package.json":{"checkedAt":1707919833833,"integrity":"sha512-vm8hQn5MuoMkjJYvBBHTAtsdrcuXmVrKZwL3FEq32oGiKFhY562FoUQTbXv24wk0rwJVpgribUCOIU98IaS9Mg==","mode":420,"size":26},"package.json":{"checkedAt":1707919833833,"integrity":"sha512-47aHCWa+7QpCFRn4hajmqfabfNBjGe1yUCdpE/GGPl+LXJZ4ldIFyo1m8R2h8M5jHC7XUGOREy0SAB23v4+hvA==","mode":420,"size":1219},"README.md":{"checkedAt":1707919833833,"integrity":"sha512-kCH2ENYjhlxwI7ae89ymMIP2tZeNcJJOcqnfifnmHQiHeK4mWnGc4w8ygoiUIpG1qyaurZkRSrYtwHCEIMNhbA==","mode":420,"size":4033},"SECURITY.md":{"checkedAt":1707919833371,"integrity":"sha512-ix30VBNb4RQLa5M2jgfD6IJ9+1XKmeREKrOYv7rDoWGZCin0605vEx3tTAVb5kNvteCwZwBC+nEGfQ4jHLg9Fw==","mode":420,"size":2757},"tslib.es6.mjs":{"checkedAt":1707919833833,"integrity":"sha512-p4vyXKQ1m9ycWubx9pwh3+bDu6Rij7K7y7jO00QNQ+d/OkaiuFQy/P+3XDIOnMvveol7ghjwh+XuyljMSUsXsA==","mode":420,"size":16249},"modules/index.d.ts":{"checkedAt":1707919833834,"integrity":"sha512-dXHqJRUlQv/CzFpupezjL+Cvt7RlhQjO4Q48X0Vr9UDhTIp8IyVFGuHc5Bn+uFiYVTD1JXjHlmfXXZ0zrnnEQg==","mode":420,"size":765},"tslib.d.ts":{"checkedAt":1707919833834,"integrity":"sha512-0voa/JhzoPTeRc2VjtIPvPsRCWdZvm7uWC9N6TngO7agfIrnz+6GpQ1XlJ3T+f47BTqVlH70T/Bvej0CpPHrmw==","mode":420,"size":17897},"CopyrightNotice.txt":{"checkedAt":1707919833834,"integrity":"sha512-C0myUddnUhhpZ/UcD9yZyMWodQV4fT2wxcfqb/ToD0Z98nB9WfWBl6koNVWJ+8jzeGWP6wQjz9zdX7Unua0/SQ==","mode":420,"size":822},"LICENSE.txt":{"checkedAt":1707919833834,"integrity":"sha512-9cs1Im06/fLAPBpXOY8fHMD2LgUM3kREaKlOX7S6fLWwbG5G+UqlUrqdkTKloRPeDghECezxOiUfzvW6lnEjDg==","mode":420,"size":655}}}
|
|
@ -0,0 +1,16 @@
|
|||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const jsonFile = require('./jsonfile')
|
||||
|
||||
jsonFile.outputJson = u(require('./output-json'))
|
||||
jsonFile.outputJsonSync = require('./output-json-sync')
|
||||
// aliases
|
||||
jsonFile.outputJSON = jsonFile.outputJson
|
||||
jsonFile.outputJSONSync = jsonFile.outputJsonSync
|
||||
jsonFile.writeJSON = jsonFile.writeJson
|
||||
jsonFile.writeJSONSync = jsonFile.writeJsonSync
|
||||
jsonFile.readJSON = jsonFile.readJson
|
||||
jsonFile.readJSONSync = jsonFile.readJsonSync
|
||||
|
||||
module.exports = jsonFile
|
|
@ -0,0 +1 @@
|
|||
export { parseSelector } from "./lib/index.js";
|
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const eslint_utils_1 = require("@typescript-eslint/utils/eslint-utils");
|
||||
const util_1 = require("../util");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'prefer-namespace-keyword',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Require using `namespace` keyword over `module` keyword to declare custom TypeScript modules',
|
||||
recommended: 'stylistic',
|
||||
},
|
||||
fixable: 'code',
|
||||
messages: {
|
||||
useNamespace: "Use 'namespace' instead of 'module' to declare custom TypeScript modules.",
|
||||
},
|
||||
schema: [],
|
||||
},
|
||||
defaultOptions: [],
|
||||
create(context) {
|
||||
const sourceCode = (0, eslint_utils_1.getSourceCode)(context);
|
||||
return {
|
||||
TSModuleDeclaration(node) {
|
||||
// Do nothing if the name is a string.
|
||||
if (node.id.type === utils_1.AST_NODE_TYPES.Literal) {
|
||||
return;
|
||||
}
|
||||
// Get tokens of the declaration header.
|
||||
const moduleType = sourceCode.getTokenBefore(node.id);
|
||||
if (moduleType &&
|
||||
moduleType.type === utils_1.AST_TOKEN_TYPES.Identifier &&
|
||||
moduleType.value === 'module') {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'useNamespace',
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(moduleType, 'namespace');
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=prefer-namespace-keyword.js.map
|
|
@ -0,0 +1,181 @@
|
|||
## 8.3.1 (2023-12-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Add `Function` and `Class` to the `AggregateType` type, so that they can be used in walkers without raising a type error.
|
||||
|
||||
Visitor functions are now called in such a way that their `this` refers to the object they are part of.
|
||||
|
||||
## 8.3.0 (2023-10-26)
|
||||
|
||||
### New features
|
||||
|
||||
Use a set of new, much more precise, TypeScript types.
|
||||
|
||||
## 8.2.0 (2021-09-06)
|
||||
|
||||
### New features
|
||||
|
||||
Add support for walking ES2022 class static blocks.
|
||||
|
||||
## 8.1.1 (2021-06-29)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Include `base` in the type declarations.
|
||||
|
||||
## 8.1.0 (2021-04-24)
|
||||
|
||||
### New features
|
||||
|
||||
Support node types for class fields and private methods.
|
||||
|
||||
## 8.0.2 (2021-01-25)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Adjust package.json to work with Node 12.16.0 and 13.0-13.6.
|
||||
|
||||
## 8.0.0 (2021-01-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug where `full` and `fullAncestor` would skip nodes with overridden types.
|
||||
|
||||
## 8.0.0 (2020-08-12)
|
||||
|
||||
### New features
|
||||
|
||||
The package can now be loaded directly as an ECMAScript module in node 13+.
|
||||
|
||||
## 7.2.0 (2020-06-17)
|
||||
|
||||
### New features
|
||||
|
||||
Support optional chaining and nullish coalescing.
|
||||
|
||||
Support `import.meta`.
|
||||
|
||||
Add support for `export * as ns from "source"`.
|
||||
|
||||
## 7.1.1 (2020-02-13)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Clean up the type definitions to actually work well with the main parser.
|
||||
|
||||
## 7.1.0 (2020-02-11)
|
||||
|
||||
### New features
|
||||
|
||||
Add a TypeScript definition file for the library.
|
||||
|
||||
## 7.0.0 (2017-08-12)
|
||||
|
||||
### New features
|
||||
|
||||
Support walking `ImportExpression` nodes.
|
||||
|
||||
## 6.2.0 (2017-07-04)
|
||||
|
||||
### New features
|
||||
|
||||
Add support for `Import` nodes.
|
||||
|
||||
## 6.1.0 (2018-09-28)
|
||||
|
||||
### New features
|
||||
|
||||
The walker now walks `TemplateElement` nodes.
|
||||
|
||||
## 6.0.1 (2018-09-14)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bad "main" field in package.json.
|
||||
|
||||
## 6.0.0 (2018-09-14)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
This is now a separate package, `acorn-walk`, rather than part of the main `acorn` package.
|
||||
|
||||
The `ScopeBody` and `ScopeExpression` meta-node-types are no longer supported.
|
||||
|
||||
## 5.7.1 (2018-06-15)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Make sure the walker and bin files are rebuilt on release (the previous release didn't get the up-to-date versions).
|
||||
|
||||
## 5.7.0 (2018-06-15)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix crash in walker when walking a binding-less catch node.
|
||||
|
||||
## 5.6.2 (2018-06-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
In the walker, go back to allowing the `baseVisitor` argument to be null to default to the default base everywhere.
|
||||
|
||||
## 5.6.1 (2018-06-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix regression when passing `null` as fourth argument to `walk.recursive`.
|
||||
|
||||
## 5.6.0 (2018-05-31)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug in the walker that caused a crash when walking an object pattern spread.
|
||||
|
||||
## 5.5.1 (2018-03-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix regression in walker causing property values in object patterns to be walked as expressions.
|
||||
|
||||
## 5.5.0 (2018-02-27)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Support object spread in the AST walker.
|
||||
|
||||
## 5.4.1 (2018-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
5.4.0 somehow accidentally included an old version of walk.js.
|
||||
|
||||
## 5.2.0 (2017-10-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
The `full` and `fullAncestor` walkers no longer visit nodes multiple times.
|
||||
|
||||
## 5.1.0 (2017-07-05)
|
||||
|
||||
### New features
|
||||
|
||||
New walker functions `full` and `fullAncestor`.
|
||||
|
||||
## 3.2.0 (2016-06-07)
|
||||
|
||||
### New features
|
||||
|
||||
Make it possible to use `visit.ancestor` with a walk state.
|
||||
|
||||
## 3.1.0 (2016-04-18)
|
||||
|
||||
### New features
|
||||
|
||||
The walker now allows defining handlers for `CatchClause` nodes.
|
||||
|
||||
## 2.5.2 (2015-10-27)
|
||||
|
||||
### Fixes
|
||||
|
||||
Fix bug where the walker walked an exported `let` statement as an expression.
|
|
@ -0,0 +1,61 @@
|
|||
type Pathname = string
|
||||
|
||||
interface TestResult {
|
||||
ignored: boolean
|
||||
unignored: boolean
|
||||
}
|
||||
|
||||
export interface Ignore {
|
||||
/**
|
||||
* Adds one or several rules to the current manager.
|
||||
* @param {string[]} patterns
|
||||
* @returns IgnoreBase
|
||||
*/
|
||||
add(patterns: string | Ignore | readonly (string | Ignore)[]): this
|
||||
|
||||
/**
|
||||
* Filters the given array of pathnames, and returns the filtered array.
|
||||
* NOTICE that each path here should be a relative path to the root of your repository.
|
||||
* @param paths the array of paths to be filtered.
|
||||
* @returns The filtered array of paths
|
||||
*/
|
||||
filter(pathnames: readonly Pathname[]): Pathname[]
|
||||
|
||||
/**
|
||||
* Creates a filter function which could filter
|
||||
* an array of paths with Array.prototype.filter.
|
||||
*/
|
||||
createFilter(): (pathname: Pathname) => boolean
|
||||
|
||||
/**
|
||||
* Returns Boolean whether pathname should be ignored.
|
||||
* @param {string} pathname a path to check
|
||||
* @returns boolean
|
||||
*/
|
||||
ignores(pathname: Pathname): boolean
|
||||
|
||||
/**
|
||||
* Returns whether pathname should be ignored or unignored
|
||||
* @param {string} pathname a path to check
|
||||
* @returns TestResult
|
||||
*/
|
||||
test(pathname: Pathname): TestResult
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
ignorecase?: boolean
|
||||
// For compatibility
|
||||
ignoreCase?: boolean
|
||||
allowRelativePaths?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new ignore manager.
|
||||
*/
|
||||
declare function ignore(options?: Options): Ignore
|
||||
|
||||
declare namespace ignore {
|
||||
export function isPathValid (pathname: string): boolean
|
||||
}
|
||||
|
||||
export default ignore
|
|
@ -0,0 +1 @@
|
|||
{"files":{"README.md":{"checkedAt":1707919835266,"integrity":"sha512-smFsNhV0uZTI2pf29+KxSH6xMVwYucpU0cGUgVUhASPiAsff4toytM2k/w3eAIzlXVe153zm+HZRLHVydSVjfA==","mode":420,"size":170},"dist/index.mjs":{"checkedAt":1707919835267,"integrity":"sha512-3sr2uUPcTheak3Z9za1EAJGuteGNFoLd8YSJdkecV0h3lItGq3NhYeTlI8YJEWfDqPtia9MnFFg4khg2FGZ0qw==","mode":420,"size":142865},"dist/onig.mjs":{"checkedAt":1707919835270,"integrity":"sha512-43fr7OdMEoEwM4YHFeuvUFK7A+5368wXUwB6Wbr2e0QxQMGckM9m9I09PRIyGgCC16tRoFJahN1deFzAI1iyDw==","mode":420,"size":622237},"dist/textmate.mjs":{"checkedAt":1707919835271,"integrity":"sha512-0OfuS6AqQDu3VvYyy29R8kcUMwpsURTS0M1yIKbjMH7V1Xi+frG9a7WJ2q1u9/zZfajUy1VQKhj9t1cFKfw+sg==","mode":420,"size":119633},"dist/types.mjs":{"checkedAt":1707919835271,"integrity":"sha512-R6siPlwm6CdRyY0owf1lij3uBAE275ef6oc2Nvru1UxMHbnzTU8CcUf/p75tnKFOsI/XS/brdmdIlY97zr/+TA==","mode":420,"size":351},"dist/wasm.mjs":{"checkedAt":1707919835271,"integrity":"sha512-LcGcHa2HBP3DW7ipUW7cVgPX8VXBkuITIsyes8ETy8oANHI+H/rBYnN8xPPYsaUX/yO2nEqdHCLq4ZS0Lunzcw==","mode":420,"size":318},"dist/chunk-types.d.mts":{"checkedAt":1707919835271,"integrity":"sha512-Nv9WVjuzUtZyNP/Q2PD0b5QZ6PISHBBA/GXSSyaYn92hYfR5ghmkCZXDn2b9ScvycOLDQ5WzVo/fPJAE7B8VQg==","mode":420,"size":36242},"dist/index.d.mts":{"checkedAt":1707919835271,"integrity":"sha512-wKAjGHgwhIZiicXk6m+A5znTxrzxlI6t2WnpIBC+uvx8dsMJQFLYKMS0KIM/Gmgl9uelNDfnos1IbzHn5PiACQ==","mode":420,"size":6900},"dist/onig.d.mts":{"checkedAt":1707919832461,"integrity":"sha512-2xuQWyaQ0snCyGRLUjTzxmbpy1lCKsXq96kfMgzn6X865F3csf2y/t8Lp+UdvD+uEZOeAG6fYCj7H9WZF+IX7Q==","mode":420,"size":57},"dist/textmate.d.mts":{"checkedAt":1707919835272,"integrity":"sha512-i39hQtr71hMTwNsszktkdqcHN/agGGP9U2Y6taIHQaBofRF54f7zQc63rt5tn3RYwUDFPAZ6ENpsnnO4eHlFtg==","mode":420,"size":1171},"dist/types.d.mts":{"checkedAt":1707919835272,"integrity":"sha512-oiXuVYyNh00QHa8lEn1aXZVSkEqq+ouA8fWWhrKA0ETg8QwCDqHDoAK15ICG6ud6jnbyWtYWMG9rydEt4eMaXg==","mode":420,"size":1341},"dist/wasm.d.mts":{"checkedAt":1707919835272,"integrity":"sha512-1NPr8v5HrQ/ATsJP0Fl9gWmHBB9CfdeUhC65IdHZdXQRyml3hiAGaxKhpHm3fQ/t0/V/ugMUJLRsyvyqBX9k0g==","mode":420,"size":127},"LICENSE":{"checkedAt":1707919832464,"integrity":"sha512-5Oyi8HU/tGbhNDzTBpEbXlDP/g0HnJ+Apx3ZgV/SLjr25kzEDWWBkjuJ9jA1oOpl9+t7JW3RLaiSrWU9mz8XIg==","mode":420,"size":1121},"package.json":{"checkedAt":1707919835272,"integrity":"sha512-8iiCqIaa0ckNHxTysLSerAZaupjdxN+dLl7f76Q3izvZV+BxlWl6OJv4SbiWbf4GA4J0Sw74UlcfTEb2nSZY0w==","mode":420,"size":1528}}}
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "esrecurse",
|
||||
"description": "ECMAScript AST recursive visitor",
|
||||
"homepage": "https://github.com/estools/esrecurse",
|
||||
"main": "esrecurse.js",
|
||||
"version": "4.3.0",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Yusuke Suzuki",
|
||||
"email": "utatane.tea@gmail.com",
|
||||
"web": "https://github.com/Constellation"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/estools/esrecurse.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"estraverse": "^5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.24.1",
|
||||
"babel-eslint": "^7.2.3",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-register": "^6.24.1",
|
||||
"chai": "^4.0.2",
|
||||
"esprima": "^4.0.0",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-bump": "^2.7.0",
|
||||
"gulp-eslint": "^4.0.0",
|
||||
"gulp-filter": "^5.0.0",
|
||||
"gulp-git": "^2.4.1",
|
||||
"gulp-mocha": "^4.3.1",
|
||||
"gulp-tag-version": "^1.2.1",
|
||||
"jsdoc": "^3.3.0-alpha10",
|
||||
"minimist": "^1.1.0"
|
||||
},
|
||||
"license": "BSD-2-Clause",
|
||||
"scripts": {
|
||||
"test": "gulp travis",
|
||||
"unit-test": "gulp test",
|
||||
"lint": "gulp lint"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
"es2015"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"name": "@unocss/astro",
|
||||
"version": "0.57.7",
|
||||
"description": "UnoCSS integration for Astro",
|
||||
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/antfu",
|
||||
"homepage": "https://github.com/unocss/unocss#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/unocss/unocss",
|
||||
"directory": "packages/astro"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/unocss/unocss/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"unocss",
|
||||
"astro",
|
||||
"astro-integration",
|
||||
"astro-component",
|
||||
"css",
|
||||
"ui"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"vite": "^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"vite": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@unocss/core": "0.57.7",
|
||||
"@unocss/reset": "0.57.7",
|
||||
"@unocss/vite": "0.57.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "^3.5.5"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"stub": "unbuild --stub"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
import { promise as queueAsPromised } from './queue.js'
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
const queue = queueAsPromised(worker, 1)
|
||||
|
||||
console.log('the result is', await queue.push(42))
|
||||
|
||||
async function worker (arg) {
|
||||
return 42 * 2
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
import { Root, Result } from 'postcss';
|
||||
import { UserConfig } from '@unocss/core';
|
||||
|
||||
interface UnoPostcssPluginOptions {
|
||||
content?: (string | {
|
||||
raw: string;
|
||||
extension: string;
|
||||
})[];
|
||||
directiveMap?: {
|
||||
apply?: string;
|
||||
screen?: string;
|
||||
theme?: string;
|
||||
unocss?: string;
|
||||
};
|
||||
cwd?: string;
|
||||
configOrPath?: string | UserConfig;
|
||||
}
|
||||
|
||||
declare function unocss(options?: UnoPostcssPluginOptions): {
|
||||
postcssPlugin: string;
|
||||
plugins: ((root: Root, result: Result) => Promise<void>)[];
|
||||
};
|
||||
declare namespace unocss {
|
||||
export var postcss: boolean;
|
||||
var _a: typeof unocss;
|
||||
export { _a as default };
|
||||
}
|
||||
|
||||
export { type UnoPostcssPluginOptions, unocss as default };
|
|
@ -0,0 +1,274 @@
|
|||
/**
|
||||
* @fileoverview Flat Config Array
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const { ConfigArray, ConfigArraySymbol } = require("@humanwhocodes/config-array");
|
||||
const { flatConfigSchema } = require("./flat-config-schema");
|
||||
const { RuleValidator } = require("./rule-validator");
|
||||
const { defaultConfig } = require("./default-config");
|
||||
const jsPlugin = require("@eslint/js");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const ruleValidator = new RuleValidator();
|
||||
|
||||
/**
|
||||
* Splits a plugin identifier in the form a/b/c into two parts: a/b and c.
|
||||
* @param {string} identifier The identifier to parse.
|
||||
* @returns {{objectName: string, pluginName: string}} The parts of the plugin
|
||||
* name.
|
||||
*/
|
||||
function splitPluginIdentifier(identifier) {
|
||||
const parts = identifier.split("/");
|
||||
|
||||
return {
|
||||
objectName: parts.pop(),
|
||||
pluginName: parts.join("/")
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of an object in the config by reading its `meta` key.
|
||||
* @param {Object} object The object to check.
|
||||
* @returns {string?} The name of the object if found or `null` if there
|
||||
* is no name.
|
||||
*/
|
||||
function getObjectId(object) {
|
||||
|
||||
// first check old-style name
|
||||
let name = object.name;
|
||||
|
||||
if (!name) {
|
||||
|
||||
if (!object.meta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
name = object.meta.name;
|
||||
|
||||
if (!name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// now check for old-style version
|
||||
let version = object.version;
|
||||
|
||||
if (!version) {
|
||||
version = object.meta && object.meta.version;
|
||||
}
|
||||
|
||||
// if there's a version then append that
|
||||
if (version) {
|
||||
return `${name}@${version}`;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
const originalBaseConfig = Symbol("originalBaseConfig");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Represents an array containing configuration information for ESLint.
|
||||
*/
|
||||
class FlatConfigArray extends ConfigArray {
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {*[]} configs An array of configuration information.
|
||||
* @param {{basePath: string, shouldIgnore: boolean, baseConfig: FlatConfig}} options The options
|
||||
* to use for the config array instance.
|
||||
*/
|
||||
constructor(configs, {
|
||||
basePath,
|
||||
shouldIgnore = true,
|
||||
baseConfig = defaultConfig
|
||||
} = {}) {
|
||||
super(configs, {
|
||||
basePath,
|
||||
schema: flatConfigSchema
|
||||
});
|
||||
|
||||
if (baseConfig[Symbol.iterator]) {
|
||||
this.unshift(...baseConfig);
|
||||
} else {
|
||||
this.unshift(baseConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* The base config used to build the config array.
|
||||
* @type {Array<FlatConfig>}
|
||||
*/
|
||||
this[originalBaseConfig] = baseConfig;
|
||||
Object.defineProperty(this, originalBaseConfig, { writable: false });
|
||||
|
||||
/**
|
||||
* Determines if `ignores` fields should be honored.
|
||||
* If true, then all `ignores` fields are honored.
|
||||
* if false, then only `ignores` fields in the baseConfig are honored.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.shouldIgnore = shouldIgnore;
|
||||
Object.defineProperty(this, "shouldIgnore", { writable: false });
|
||||
}
|
||||
|
||||
/* eslint-disable class-methods-use-this -- Desired as instance method */
|
||||
/**
|
||||
* Replaces a config with another config to allow us to put strings
|
||||
* in the config array that will be replaced by objects before
|
||||
* normalization.
|
||||
* @param {Object} config The config to preprocess.
|
||||
* @returns {Object} The preprocessed config.
|
||||
*/
|
||||
[ConfigArraySymbol.preprocessConfig](config) {
|
||||
if (config === "eslint:recommended") {
|
||||
|
||||
// if we are in a Node.js environment warn the user
|
||||
if (typeof process !== "undefined" && process.emitWarning) {
|
||||
process.emitWarning("The 'eslint:recommended' string configuration is deprecated and will be replaced by the @eslint/js package's 'recommended' config.");
|
||||
}
|
||||
|
||||
return jsPlugin.configs.recommended;
|
||||
}
|
||||
|
||||
if (config === "eslint:all") {
|
||||
|
||||
// if we are in a Node.js environment warn the user
|
||||
if (typeof process !== "undefined" && process.emitWarning) {
|
||||
process.emitWarning("The 'eslint:all' string configuration is deprecated and will be replaced by the @eslint/js package's 'all' config.");
|
||||
}
|
||||
|
||||
return jsPlugin.configs.all;
|
||||
}
|
||||
|
||||
/*
|
||||
* If `shouldIgnore` is false, we remove any ignore patterns specified
|
||||
* in the config so long as it's not a default config and it doesn't
|
||||
* have a `files` entry.
|
||||
*/
|
||||
if (
|
||||
!this.shouldIgnore &&
|
||||
!this[originalBaseConfig].includes(config) &&
|
||||
config.ignores &&
|
||||
!config.files
|
||||
) {
|
||||
/* eslint-disable-next-line no-unused-vars -- need to strip off other keys */
|
||||
const { ignores, ...otherKeys } = config;
|
||||
|
||||
return otherKeys;
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalizes the config by replacing plugin references with their objects
|
||||
* and validating rule option schemas.
|
||||
* @param {Object} config The config to finalize.
|
||||
* @returns {Object} The finalized config.
|
||||
* @throws {TypeError} If the config is invalid.
|
||||
*/
|
||||
[ConfigArraySymbol.finalizeConfig](config) {
|
||||
|
||||
const { plugins, languageOptions, processor } = config;
|
||||
let parserName, processorName;
|
||||
let invalidParser = false,
|
||||
invalidProcessor = false;
|
||||
|
||||
// Check parser value
|
||||
if (languageOptions && languageOptions.parser) {
|
||||
const { parser } = languageOptions;
|
||||
|
||||
if (typeof parser === "object") {
|
||||
parserName = getObjectId(parser);
|
||||
|
||||
if (!parserName) {
|
||||
invalidParser = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
invalidParser = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Check processor value
|
||||
if (processor) {
|
||||
if (typeof processor === "string") {
|
||||
const { pluginName, objectName: localProcessorName } = splitPluginIdentifier(processor);
|
||||
|
||||
processorName = processor;
|
||||
|
||||
if (!plugins || !plugins[pluginName] || !plugins[pluginName].processors || !plugins[pluginName].processors[localProcessorName]) {
|
||||
throw new TypeError(`Key "processor": Could not find "${localProcessorName}" in plugin "${pluginName}".`);
|
||||
}
|
||||
|
||||
config.processor = plugins[pluginName].processors[localProcessorName];
|
||||
} else if (typeof processor === "object") {
|
||||
processorName = getObjectId(processor);
|
||||
|
||||
if (!processorName) {
|
||||
invalidProcessor = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
invalidProcessor = true;
|
||||
}
|
||||
}
|
||||
|
||||
ruleValidator.validate(config);
|
||||
|
||||
// apply special logic for serialization into JSON
|
||||
/* eslint-disable object-shorthand -- shorthand would change "this" value */
|
||||
Object.defineProperty(config, "toJSON", {
|
||||
value: function() {
|
||||
|
||||
if (invalidParser) {
|
||||
throw new Error("Could not serialize parser object (missing 'meta' object).");
|
||||
}
|
||||
|
||||
if (invalidProcessor) {
|
||||
throw new Error("Could not serialize processor object (missing 'meta' object).");
|
||||
}
|
||||
|
||||
return {
|
||||
...this,
|
||||
plugins: Object.entries(plugins).map(([namespace, plugin]) => {
|
||||
|
||||
const pluginId = getObjectId(plugin);
|
||||
|
||||
if (!pluginId) {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
return `${namespace}:${pluginId}`;
|
||||
}),
|
||||
languageOptions: {
|
||||
...languageOptions,
|
||||
parser: parserName
|
||||
},
|
||||
processor: processorName
|
||||
};
|
||||
}
|
||||
});
|
||||
/* eslint-enable object-shorthand -- ok to enable now */
|
||||
|
||||
return config;
|
||||
}
|
||||
/* eslint-enable class-methods-use-this -- Desired as instance method */
|
||||
|
||||
}
|
||||
|
||||
exports.FlatConfigArray = FlatConfigArray;
|
|
@ -0,0 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
module.exports = function shimGetPrototypeOf() {
|
||||
define(
|
||||
global,
|
||||
{ Reflect: {} },
|
||||
{ Reflect: function () { return typeof Reflect !== 'object' || !Reflect; } }
|
||||
);
|
||||
|
||||
var polyfill = getPolyfill();
|
||||
define(
|
||||
Reflect,
|
||||
{ getPrototypeOf: polyfill },
|
||||
{ getPrototypeOf: function () { return Reflect.getPrototypeOf !== polyfill; } }
|
||||
);
|
||||
|
||||
return polyfill;
|
||||
};
|
|
@ -0,0 +1,18 @@
|
|||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var forEach = require('for-each');
|
||||
|
||||
var shims = require('../');
|
||||
|
||||
forEach(shims, function (shim) {
|
||||
var shimTests;
|
||||
try {
|
||||
shimTests = require('./' + shim); // eslint-disable-line global-require
|
||||
} catch (e) {
|
||||
test(shim + ': implementation', { todo: true });
|
||||
}
|
||||
if (shimTests) {
|
||||
shimTests.implementation();
|
||||
}
|
||||
});
|
|
@ -0,0 +1,49 @@
|
|||
'use strict';
|
||||
|
||||
const icon_defaults = require('../icon/defaults.cjs');
|
||||
const iconSet_tree = require('./tree.cjs');
|
||||
|
||||
const propsToCopy = Object.keys(icon_defaults.defaultIconDimensions).concat([
|
||||
"provider"
|
||||
]);
|
||||
function getIcons(data, names, not_found) {
|
||||
const icons = /* @__PURE__ */ Object.create(null);
|
||||
const aliases = /* @__PURE__ */ Object.create(null);
|
||||
const result = {
|
||||
prefix: data.prefix,
|
||||
icons
|
||||
};
|
||||
const sourceIcons = data.icons;
|
||||
const sourceAliases = data.aliases || /* @__PURE__ */ Object.create(null);
|
||||
if (data.lastModified) {
|
||||
result.lastModified = data.lastModified;
|
||||
}
|
||||
const tree = iconSet_tree.getIconsTree(data, names);
|
||||
let empty = true;
|
||||
for (const name in tree) {
|
||||
if (!tree[name]) {
|
||||
if (not_found && names.indexOf(name) !== -1) {
|
||||
(result.not_found || (result.not_found = [])).push(name);
|
||||
}
|
||||
} else if (sourceIcons[name]) {
|
||||
icons[name] = {
|
||||
...sourceIcons[name]
|
||||
};
|
||||
empty = false;
|
||||
} else {
|
||||
aliases[name] = {
|
||||
...sourceAliases[name]
|
||||
};
|
||||
result.aliases = aliases;
|
||||
}
|
||||
}
|
||||
propsToCopy.forEach((attr) => {
|
||||
if (attr in data) {
|
||||
result[attr] = data[attr];
|
||||
}
|
||||
});
|
||||
return empty && not_found !== true ? null : result;
|
||||
}
|
||||
|
||||
exports.getIcons = getIcons;
|
||||
exports.propsToCopy = propsToCopy;
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,2 @@
|
|||
export * from "./declarations/src/index.js";
|
||||
//# sourceMappingURL=changesets-git.cjs.d.mts.map
|
|
@ -0,0 +1,236 @@
|
|||
#!/usr/bin/env node
|
||||
/*
|
||||
Copyright JS Foundation and other contributors, https://js.foundation/
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*jslint sloppy:true plusplus:true node:true rhino:true */
|
||||
/*global phantom:true */
|
||||
|
||||
var fs, system, esprima, options, fnames, forceFile, count;
|
||||
|
||||
if (typeof esprima === 'undefined') {
|
||||
// PhantomJS can only require() relative files
|
||||
if (typeof phantom === 'object') {
|
||||
fs = require('fs');
|
||||
system = require('system');
|
||||
esprima = require('./esprima');
|
||||
} else if (typeof require === 'function') {
|
||||
fs = require('fs');
|
||||
try {
|
||||
esprima = require('esprima');
|
||||
} catch (e) {
|
||||
esprima = require('../');
|
||||
}
|
||||
} else if (typeof load === 'function') {
|
||||
try {
|
||||
load('esprima.js');
|
||||
} catch (e) {
|
||||
load('../esprima.js');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Shims to Node.js objects when running under PhantomJS 1.7+.
|
||||
if (typeof phantom === 'object') {
|
||||
fs.readFileSync = fs.read;
|
||||
process = {
|
||||
argv: [].slice.call(system.args),
|
||||
exit: phantom.exit,
|
||||
on: function (evt, callback) {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
process.argv.unshift('phantomjs');
|
||||
}
|
||||
|
||||
// Shims to Node.js objects when running under Rhino.
|
||||
if (typeof console === 'undefined' && typeof process === 'undefined') {
|
||||
console = { log: print };
|
||||
fs = { readFileSync: readFile };
|
||||
process = {
|
||||
argv: arguments,
|
||||
exit: quit,
|
||||
on: function (evt, callback) {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
process.argv.unshift('esvalidate.js');
|
||||
process.argv.unshift('rhino');
|
||||
}
|
||||
|
||||
function showUsage() {
|
||||
console.log('Usage:');
|
||||
console.log(' esvalidate [options] [file.js...]');
|
||||
console.log();
|
||||
console.log('Available options:');
|
||||
console.log();
|
||||
console.log(' --format=type Set the report format, plain (default) or junit');
|
||||
console.log(' -v, --version Print program version');
|
||||
console.log();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
options = {
|
||||
format: 'plain'
|
||||
};
|
||||
|
||||
fnames = [];
|
||||
|
||||
process.argv.splice(2).forEach(function (entry) {
|
||||
|
||||
if (forceFile || entry === '-' || entry.slice(0, 1) !== '-') {
|
||||
fnames.push(entry);
|
||||
} else if (entry === '-h' || entry === '--help') {
|
||||
showUsage();
|
||||
} else if (entry === '-v' || entry === '--version') {
|
||||
console.log('ECMAScript Validator (using Esprima version', esprima.version, ')');
|
||||
console.log();
|
||||
process.exit(0);
|
||||
} else if (entry.slice(0, 9) === '--format=') {
|
||||
options.format = entry.slice(9);
|
||||
if (options.format !== 'plain' && options.format !== 'junit') {
|
||||
console.log('Error: unknown report format ' + options.format + '.');
|
||||
process.exit(1);
|
||||
}
|
||||
} else if (entry === '--') {
|
||||
forceFile = true;
|
||||
} else {
|
||||
console.log('Error: unknown option ' + entry + '.');
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
if (fnames.length === 0) {
|
||||
fnames.push('');
|
||||
}
|
||||
|
||||
if (options.format === 'junit') {
|
||||
console.log('<?xml version="1.0" encoding="UTF-8"?>');
|
||||
console.log('<testsuites>');
|
||||
}
|
||||
|
||||
count = 0;
|
||||
|
||||
function run(fname, content) {
|
||||
var timestamp, syntax, name;
|
||||
try {
|
||||
if (typeof content !== 'string') {
|
||||
throw content;
|
||||
}
|
||||
|
||||
if (content[0] === '#' && content[1] === '!') {
|
||||
content = '//' + content.substr(2, content.length);
|
||||
}
|
||||
|
||||
timestamp = Date.now();
|
||||
syntax = esprima.parse(content, { tolerant: true });
|
||||
|
||||
if (options.format === 'junit') {
|
||||
|
||||
name = fname;
|
||||
if (name.lastIndexOf('/') >= 0) {
|
||||
name = name.slice(name.lastIndexOf('/') + 1);
|
||||
}
|
||||
|
||||
console.log('<testsuite name="' + fname + '" errors="0" ' +
|
||||
' failures="' + syntax.errors.length + '" ' +
|
||||
' tests="' + syntax.errors.length + '" ' +
|
||||
' time="' + Math.round((Date.now() - timestamp) / 1000) +
|
||||
'">');
|
||||
|
||||
syntax.errors.forEach(function (error) {
|
||||
var msg = error.message;
|
||||
msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
|
||||
console.log(' <testcase name="Line ' + error.lineNumber + ': ' + msg + '" ' +
|
||||
' time="0">');
|
||||
console.log(' <error type="SyntaxError" message="' + error.message + '">' +
|
||||
error.message + '(' + name + ':' + error.lineNumber + ')' +
|
||||
'</error>');
|
||||
console.log(' </testcase>');
|
||||
});
|
||||
|
||||
console.log('</testsuite>');
|
||||
|
||||
} else if (options.format === 'plain') {
|
||||
|
||||
syntax.errors.forEach(function (error) {
|
||||
var msg = error.message;
|
||||
msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
|
||||
msg = fname + ':' + error.lineNumber + ': ' + msg;
|
||||
console.log(msg);
|
||||
++count;
|
||||
});
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
++count;
|
||||
if (options.format === 'junit') {
|
||||
console.log('<testsuite name="' + fname + '" errors="1" failures="0" tests="1" ' +
|
||||
' time="' + Math.round((Date.now() - timestamp) / 1000) + '">');
|
||||
console.log(' <testcase name="' + e.message + '" ' + ' time="0">');
|
||||
console.log(' <error type="ParseError" message="' + e.message + '">' +
|
||||
e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') +
|
||||
')</error>');
|
||||
console.log(' </testcase>');
|
||||
console.log('</testsuite>');
|
||||
} else {
|
||||
console.log(fname + ':' + e.lineNumber + ': ' + e.message.replace(/^Line\ [0-9]*\:\ /, ''));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fnames.forEach(function (fname) {
|
||||
var content = '';
|
||||
try {
|
||||
if (fname && (fname !== '-' || forceFile)) {
|
||||
content = fs.readFileSync(fname, 'utf-8');
|
||||
} else {
|
||||
fname = '';
|
||||
process.stdin.resume();
|
||||
process.stdin.on('data', function(chunk) {
|
||||
content += chunk;
|
||||
});
|
||||
process.stdin.on('end', function() {
|
||||
run(fname, content);
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
content = e;
|
||||
}
|
||||
run(fname, content);
|
||||
});
|
||||
|
||||
process.on('exit', function () {
|
||||
if (options.format === 'junit') {
|
||||
console.log('</testsuites>');
|
||||
}
|
||||
|
||||
if (count > 0) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (count === 0 && typeof phantom === 'object') {
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
|
@ -0,0 +1,39 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.transform = void 0;
|
||||
const utils_1 = require("./utils");
|
||||
function transform(node, context) {
|
||||
const less = loadLess(context);
|
||||
if (!less) {
|
||||
return null;
|
||||
}
|
||||
const inputRange = (0, utils_1.getContentRange)(node);
|
||||
const code = context.getSourceCode().text.slice(...inputRange);
|
||||
const filename = `${context.getFilename()}.less`;
|
||||
try {
|
||||
let output;
|
||||
less.render(code, {
|
||||
sourceMap: {},
|
||||
syncImport: true,
|
||||
filename,
|
||||
lint: false,
|
||||
}, (_error, result) => {
|
||||
output = result;
|
||||
});
|
||||
if (!output) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
inputRange,
|
||||
output: output.css,
|
||||
mappings: JSON.parse(output.map).mappings,
|
||||
};
|
||||
}
|
||||
catch (_e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
exports.transform = transform;
|
||||
function loadLess(context) {
|
||||
return (0, utils_1.loadModule)(context, "less");
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
module.exports={A:{A:{"1":"F A B","8":"J RC","129":"D","257":"E"},B:{"1":"0 1 2 3 4 5 6 7 8 C K L G M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p w x y z q H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 SC 6B I J D E F A B C K L G M N O AB r s t u BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB 7B kB 8B lB mB nB oB pB qB rB sB tB uB vB v wB xB yB zB 0B P Q R 9B S T U V W X Y Z a b c d e f g h i j k l m n o p w x y z q H AC BC TC UC VC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I J D E F A B C K L G M N O AB r s t u BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB 7B kB 8B lB mB nB oB pB qB rB sB tB uB vB v wB xB yB zB 0B P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p w x y z q H AC BC"},E:{"1":"9 I J D E F A B C K L G WC CC XC YC ZC aC DC 1B 2B EC bC cC FC GC 3B dC 4B HC IC JC KC LC eC 5B MC NC OC fC"},F:{"1":"F B C G M N O AB r s t u BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB v wB xB yB zB 0B P Q R 9B S T U V W X Y Z a b c d e f g h i j k l m n o p gC hC iC jC 1B PC kC 2B"},G:{"1":"E CC lC QC mC nC oC pC qC rC sC tC uC vC wC xC yC zC 0C 1C 2C 3C 4C FC GC 3B 5C 4B HC IC JC KC LC 6C 5B MC NC OC"},H:{"1":"7C"},I:{"1":"6B I H 8C 9C AD BD QC CD DD"},J:{"1":"D A"},K:{"1":"A B C v 1B PC 2B"},L:{"1":"H"},M:{"1":"q"},N:{"1":"A B"},O:{"1":"3B"},P:{"1":"I r s t u ED FD GD HD ID DC JD KD LD MD ND 4B 5B OD PD"},Q:{"1":"EC"},R:{"1":"QD"},S:{"1":"RD SD"}},B:2,C:"CSS min/max-width/height",D:true};
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"name": "@nodelib/fs.stat",
|
||||
"version": "2.0.5",
|
||||
"description": "Get the status of a file with some features",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat",
|
||||
"keywords": [
|
||||
"NodeLib",
|
||||
"fs",
|
||||
"FileSystem",
|
||||
"file system",
|
||||
"stat"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
},
|
||||
"files": [
|
||||
"out/**",
|
||||
"!out/**/*.map",
|
||||
"!out/**/*.spec.*"
|
||||
],
|
||||
"main": "out/index.js",
|
||||
"typings": "out/index.d.ts",
|
||||
"scripts": {
|
||||
"clean": "rimraf {tsconfig.tsbuildinfo,out}",
|
||||
"lint": "eslint \"src/**/*.ts\" --cache",
|
||||
"compile": "tsc -b .",
|
||||
"compile:watch": "tsc -p . --watch --sourceMap",
|
||||
"test": "mocha \"out/**/*.spec.js\" -s 0",
|
||||
"build": "npm run clean && npm run compile && npm run lint && npm test",
|
||||
"watch": "npm run clean && npm run compile:watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nodelib/fs.macchiato": "1.0.4"
|
||||
},
|
||||
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562"
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
// Note: extra types exposed from `index.d.ts`.
|
||||
export {fromParse5} from './lib/index.js'
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"Visitor.js","sourceRoot":"","sources":["../../src/referencer/Visitor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMA,qDAAkD;AAClD,+CAA4D;AAqC1C,4FArCT,yBAAW,OAqCS;AAhC7B,MAAM,OAAQ,SAAQ,yBAAW;IAE/B,YAAY,gBAA0C;QACpD,KAAK,CACH,gBAAgB,YAAY,OAAO;YACjC,CAAC,CAAC,uBAAA,gBAAgB,wBAAS;YAC3B,CAAC,CAAC,gBAAgB,CACrB,CAAC;QANK,mCAAyB;QAQhC,uBAAA,IAAI,oBACF,gBAAgB,YAAY,OAAO;YACjC,CAAC,CAAC,uBAAA,gBAAgB,wBAAS;YAC3B,CAAC,CAAC,gBAAgB,MAAA,CAAC;IACzB,CAAC;IAES,YAAY,CACpB,IAAmB,EACnB,QAAgC,EAChC,UAA+B,EAAE,qBAAqB,EAAE,KAAK,EAAE;QAE/D,iFAAiF;QACjF,MAAM,OAAO,GAAG,IAAI,+BAAc,CAAC,uBAAA,IAAI,wBAAS,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAElE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEpB,4CAA4C;QAC5C,IAAI,OAAO,CAAC,qBAAqB,EAAE;YACjC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;SAClD;IACH,CAAC;CACF;AAEQ,0BAAO"}
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const binaryExtensions = require('binary-extensions');
|
||||
|
||||
const extensions = new Set(binaryExtensions);
|
||||
|
||||
module.exports = filePath => extensions.has(path.extname(filePath).slice(1).toLowerCase());
|
|
@ -0,0 +1,49 @@
|
|||
"use strict";
|
||||
|
||||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
var stringify = require('.');
|
||||
|
||||
var _require = require('string_decoder'),
|
||||
StringDecoder = _require.StringDecoder;
|
||||
|
||||
module.exports = function (records) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
var data = [];
|
||||
|
||||
if (Buffer.isBuffer(records)) {
|
||||
var decoder = new StringDecoder();
|
||||
records = decoder.write(records);
|
||||
}
|
||||
|
||||
function onData(record) {
|
||||
if (record) {
|
||||
data.push(record.toString());
|
||||
}
|
||||
}
|
||||
|
||||
var stringifier = new stringify.Stringifier(options);
|
||||
stringifier.on('data', onData);
|
||||
|
||||
var _iterator = _createForOfIteratorHelper(records),
|
||||
_step;
|
||||
|
||||
try {
|
||||
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||||
var record = _step.value;
|
||||
stringifier.write(record);
|
||||
}
|
||||
} catch (err) {
|
||||
_iterator.e(err);
|
||||
} finally {
|
||||
_iterator.f();
|
||||
}
|
||||
|
||||
stringifier.end();
|
||||
stringifier.off('data', onData);
|
||||
return data.join('');
|
||||
};
|
|
@ -0,0 +1,41 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.1.1](https://github.com/ljharb/define-data-property/compare/v1.1.0...v1.1.1) - 2023-10-12
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] fix tests in ES3 engines [`5c6920e`](https://github.com/ljharb/define-data-property/commit/5c6920edd1f52f675b02f417e539c28135b43f94)
|
||||
- [Dev Deps] update `@types/es-value-fixtures`, `@types/for-each`, `@types/gopd`, `@types/has-property-descriptors`, `tape`, `typescript` [`7d82dfc`](https://github.com/ljharb/define-data-property/commit/7d82dfc20f778b4465bba06335dd53f6f431aea3)
|
||||
- [Fix] IE 8 has a broken `Object.defineProperty` [`0672e1a`](https://github.com/ljharb/define-data-property/commit/0672e1af2a9fcc787e7c23b96dea60d290df5548)
|
||||
- [meta] emit types on prepack [`73acb1f`](https://github.com/ljharb/define-data-property/commit/73acb1f903c21b314ec7156bf10f73c7910530c0)
|
||||
- [Dev Deps] update `tape`, `typescript` [`9489a77`](https://github.com/ljharb/define-data-property/commit/9489a7738bf2ecf0ac71d5b78ec4ca6ad7ba0142)
|
||||
|
||||
## [v1.1.0](https://github.com/ljharb/define-data-property/compare/v1.0.1...v1.1.0) - 2023-09-13
|
||||
|
||||
### Commits
|
||||
|
||||
- [New] add `loose` arg [`155235a`](https://github.com/ljharb/define-data-property/commit/155235a4c4d7741f6de01cd87c99599a56654b72)
|
||||
- [New] allow `null` to be passed for the non* args [`7d2fa5f`](https://github.com/ljharb/define-data-property/commit/7d2fa5f06be0392736c13b126f7cd38979f34792)
|
||||
|
||||
## [v1.0.1](https://github.com/ljharb/define-data-property/compare/v1.0.0...v1.0.1) - 2023-09-12
|
||||
|
||||
### Commits
|
||||
|
||||
- [meta] add TS types [`43d763c`](https://github.com/ljharb/define-data-property/commit/43d763c6c883f652de1c9c02ef6216ee507ffa69)
|
||||
- [Dev Deps] update `@types/tape`, `typescript` [`f444985`](https://github.com/ljharb/define-data-property/commit/f444985811c36f3e6448a03ad2f9b7898917f4c7)
|
||||
- [meta] add `safe-publish-latest`, [`172bb10`](https://github.com/ljharb/define-data-property/commit/172bb10890896ebb160e64398f6ee55760107bee)
|
||||
|
||||
## v1.0.0 - 2023-09-12
|
||||
|
||||
### Commits
|
||||
|
||||
- Initial implementation, tests, readme [`5b43d6b`](https://github.com/ljharb/define-data-property/commit/5b43d6b44e675a904810467a7d4e0adb7efc3196)
|
||||
- Initial commit [`35e577a`](https://github.com/ljharb/define-data-property/commit/35e577a6ba59a98befa97776d70d90f3bea9009d)
|
||||
- npm init [`82a0a04`](https://github.com/ljharb/define-data-property/commit/82a0a04a321ca7de220af02d41e2745e8a9962ed)
|
||||
- Only apps should have lockfiles [`96df244`](https://github.com/ljharb/define-data-property/commit/96df244a3c6f426f9a2437be825d1c6f5dd7158e)
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`a87ff18`](https://github.com/ljharb/define-data-property/commit/a87ff18cb79e14c2eb5720486c4759fd9a189375)
|
|
@ -0,0 +1 @@
|
|||
module.exports={C:{"52":0.00578,"56":0.04047,"59":0.01156,"88":0.00578,"108":0.00578,"113":0.00578,"115":0.08672,"117":0.00578,"118":0.00578,"119":0.01734,"120":0.34108,"121":0.10984,_:"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 27 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 54 55 57 58 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 109 110 111 112 114 116 122 123 124 3.5 3.6"},D:{"49":0.01734,"56":0.01156,"58":0.00578,"66":0.04625,"69":0.00578,"71":0.00578,"73":0.00578,"75":0.01156,"76":0.01156,"78":0.01156,"79":0.05203,"80":0.00578,"81":0.00578,"83":0.02312,"84":0.00578,"85":0.01156,"86":0.00578,"87":0.06359,"88":0.02312,"89":0.00578,"90":0.00578,"91":0.01734,"92":0.01734,"93":0.21968,"94":0.01734,"95":0.01156,"96":0.01156,"97":0.01156,"98":0.00578,"99":0.05781,"100":0.00578,"101":0.01156,"102":0.01734,"103":0.44514,"104":0.02312,"105":0.05203,"106":0.04047,"107":0.03469,"108":0.04047,"109":2.41646,"110":0.02891,"111":0.07515,"112":0.07515,"113":0.08672,"114":0.18499,"115":0.07515,"116":0.41045,"117":0.26015,"118":0.88449,"119":17.2216,"120":23.65585,"121":0.04047,"122":0.00578,_:"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 38 39 40 41 42 43 44 45 46 47 48 50 51 52 53 54 55 57 59 60 61 62 63 64 65 67 68 70 72 74 77 123"},F:{"28":0.01734,"36":0.00578,"46":0.00578,"95":0.01734,"102":0.00578,"104":0.56076,"105":0.62435,"106":0.01156,_:"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 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 96 97 98 99 100 101 103 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"17":0.00578,"18":0.00578,"92":0.01734,"100":0.00578,"107":0.00578,"108":0.00578,"109":0.03469,"110":0.01156,"114":0.01734,"115":0.01156,"116":0.01734,"117":0.02891,"118":0.02891,"119":1.63024,"120":3.19689,_:"12 13 14 15 16 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 101 102 103 104 105 106 111 112 113"},E:{"13":0.00578,"14":0.01156,"15":0.00578,_:"0 4 5 6 7 8 9 10 11 12 3.1 3.2 5.1 6.1 7.1 9.1 10.1 17.3","11.1":0.01156,"12.1":0.00578,"13.1":0.01734,"14.1":0.02891,"15.1":0.01156,"15.2-15.3":0.00578,"15.4":0.01156,"15.5":0.01734,"15.6":0.07515,"16.0":0.00578,"16.1":0.02891,"16.2":0.01734,"16.3":0.04047,"16.4":0.01734,"16.5":0.02891,"16.6":0.15031,"17.0":0.04047,"17.1":0.31217,"17.2":0.04047},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00085,"5.0-5.1":0.00085,"6.0-6.1":0.00169,"7.0-7.1":0.00296,"8.1-8.4":0.00085,"9.0-9.2":0.00296,"9.3":0.01016,"10.0-10.2":0.00085,"10.3":0.01566,"11.0-11.2":0.00592,"11.3-11.4":0.00719,"12.0-12.1":0.00381,"12.2-12.5":0.07786,"13.0-13.1":0.00169,"13.2":0.01227,"13.3":0.00423,"13.4-13.7":0.01523,"14.0-14.4":0.03004,"14.5-14.8":0.04739,"15.0-15.1":0.02031,"15.2-15.3":0.02327,"15.4":0.02835,"15.5":0.03639,"15.6-15.8":0.27929,"16.0":0.08844,"16.1":0.19,"16.2":0.08421,"16.3":0.15826,"16.4":0.03174,"16.5":0.07575,"16.6-16.7":0.66691,"17.0":0.11849,"17.1":1.96941,"17.2":0.20608,"17.3":0.01016},P:{"4":0.13747,"20":0.01057,"21":0.02115,"22":0.0423,"23":0.53932,"5.0-5.4":0.01057,"6.2-6.4":0.02115,_:"7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 14.0 15.0 16.0 18.0","13.0":0.01057,"17.0":0.01057,"19.0":0.01057},I:{"0":0.063,"3":0,"4":0.00001,"2.1":0,"2.2":0.00001,"2.3":0,"4.1":0.00001,"4.2-4.3":0.00004,"4.4":0,"4.4.3-4.4.4":0.00018},K:{"0":0.48097,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.46826,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.07172},Q:{"13.1":0.00844},O:{"0":0.37127},H:{"0":0},L:{"0":38.1995}};
|
|
@ -0,0 +1,3 @@
|
|||
function i(o){return t=>t.type===o}var n={parent(o){return Array.isArray(o.children)},literal(o){return typeof o.value=="string"},tag(o){return o.type==="element"||o.type==="custom-element"||o.type==="component"||o.type==="fragment"},whitespace(o){return o.type==="text"&&o.value.trim().length===0},root:i("root"),element:i("element"),customElement:i("custom-element"),component:i("component"),fragment:i("fragment"),expression:i("expression"),text:i("text"),doctype:i("doctype"),comment:i("comment"),frontmatter:i("frontmatter")},l=class{constructor(t){this.callback=t}async visit(t,e,s){if(await this.callback(t,e,s),n.parent(t)){let r=[];for(let a=0;a<t.children.length;a++){let m=t.children[a];r.push(this.callback(m,t,a))}await Promise.all(r)}}};function N(o,t){new l(t).visit(o)}function c(o){let t="";for(let e of o.attributes)switch(t+=" ",e.kind){case"empty":{t+=`${e.name}`;break}case"expression":{t+=`${e.name}={${e.value}}`;break}case"quoted":{t+=`${e.name}=${e.raw}`;break}case"template-literal":{t+=`${e.name}=\`${e.value}\``;break}case"shorthand":{t+=`{${e.name}}`;break}case"spread":{t+=`{...${e.name}}`;break}}return t}function u(o,t={selfClose:!0}){let e="";function s(r){n.root(r)?r.children.forEach(a=>s(a)):n.frontmatter(r)?e+=`---${r.value}---
|
||||
|
||||
`:n.comment(r)?e+=`<!--${r.value}-->`:n.expression(r)?(e+="{",r.children.forEach(a=>s(a)),e+="}"):n.literal(r)?e+=r.value:n.tag(r)&&(e+=`<${r.name}`,e+=c(r),r.children.length==0&&t.selfClose?e+=" />":(e+=">",r.children.forEach(a=>s(a)),e+=`</${r.name}>`))}return s(o),e}export{n as is,u as serialize,N as walk};
|
|
@ -0,0 +1,5 @@
|
|||
'use strict'
|
||||
|
||||
module.exports.isClean = Symbol('isClean')
|
||||
|
||||
module.exports.my = Symbol('my')
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,9 @@
|
|||
module.exports = {
|
||||
y: 1 << 0,
|
||||
n: 1 << 1,
|
||||
a: 1 << 2,
|
||||
p: 1 << 3,
|
||||
u: 1 << 4,
|
||||
x: 1 << 5,
|
||||
d: 1 << 6
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
import { JOSENotSupported } from '../util/errors.js';
|
||||
export default function dsaDigest(alg) {
|
||||
switch (alg) {
|
||||
case 'PS256':
|
||||
case 'RS256':
|
||||
case 'ES256':
|
||||
case 'ES256K':
|
||||
return 'sha256';
|
||||
case 'PS384':
|
||||
case 'RS384':
|
||||
case 'ES384':
|
||||
return 'sha384';
|
||||
case 'PS512':
|
||||
case 'RS512':
|
||||
case 'ES512':
|
||||
return 'sha512';
|
||||
case 'EdDSA':
|
||||
return undefined;
|
||||
default:
|
||||
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/which-boxed-primitive
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
@ -0,0 +1,63 @@
|
|||
import type * as vite from 'vite';
|
||||
import type { InlineConfig } from 'vite';
|
||||
import type { AstroConfig, AstroSettings, ComponentInstance, ManifestData, MiddlewareHandler, RouteData, RuntimeMode, SSRLoadedRenderer } from '../../@types/astro.js';
|
||||
import type { Logger } from '../logger/core.js';
|
||||
import type { RouteCache } from '../render/route-cache.js';
|
||||
export type ComponentPath = string;
|
||||
export type ViteID = string;
|
||||
export type PageOutput = AstroConfig['output'];
|
||||
export type StylesheetAsset = {
|
||||
type: 'inline';
|
||||
content: string;
|
||||
} | {
|
||||
type: 'external';
|
||||
src: string;
|
||||
};
|
||||
export interface PageBuildData {
|
||||
component: ComponentPath;
|
||||
route: RouteData;
|
||||
moduleSpecifier: string;
|
||||
propagatedStyles: Map<string, Set<StylesheetAsset>>;
|
||||
propagatedScripts: Map<string, Set<string>>;
|
||||
hoistedScript: {
|
||||
type: 'inline' | 'external';
|
||||
value: string;
|
||||
} | undefined;
|
||||
styles: Array<{
|
||||
depth: number;
|
||||
order: number;
|
||||
sheet: StylesheetAsset;
|
||||
}>;
|
||||
hasSharedModules: boolean;
|
||||
}
|
||||
export type AllPagesData = Record<ComponentPath, PageBuildData>;
|
||||
/** Options for the static build */
|
||||
export interface StaticBuildOptions {
|
||||
allPages: AllPagesData;
|
||||
settings: AstroSettings;
|
||||
logger: Logger;
|
||||
manifest: ManifestData;
|
||||
mode: RuntimeMode;
|
||||
origin: string;
|
||||
pageNames: string[];
|
||||
routeCache: RouteCache;
|
||||
viteConfig: InlineConfig;
|
||||
teardownCompiler: boolean;
|
||||
}
|
||||
type ImportComponentInstance = () => Promise<ComponentInstance>;
|
||||
export interface SinglePageBuiltModule {
|
||||
page: ImportComponentInstance;
|
||||
/**
|
||||
* The `onRequest` hook exported by the middleware
|
||||
*/
|
||||
onRequest?: MiddlewareHandler;
|
||||
renderers: SSRLoadedRenderer[];
|
||||
}
|
||||
export type ViteBuildReturn = Awaited<ReturnType<typeof vite.build>>;
|
||||
export type RollupOutput = Extract<Extract<ViteBuildReturn, Exclude<ViteBuildReturn, Array<any>>>, {
|
||||
output: any;
|
||||
}>;
|
||||
export type OutputChunk = Extract<RollupOutput['output'][number], {
|
||||
type: 'chunk';
|
||||
}>;
|
||||
export {};
|
|
@ -0,0 +1 @@
|
|||
Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python;
|
|
@ -0,0 +1 @@
|
|||
{"files":{"LICENSE":{"checkedAt":1707919832841,"integrity":"sha512-arS2Pilqch2xz5c3GYBa15akt3T0Lenikn5xIPUzT936ymD0CJkdIFHLRdVSJWzkgWETFdnzpboKECPN9yhSWw==","mode":420,"size":1081},"base64js.min.js":{"checkedAt":1707919832841,"integrity":"sha512-lLcC9HW1OX4nBfl9z37kP5wliBgGQUWqE9Vu20ceI8/SZodj5O8s4QI81UkPxqOAsGHlUT6sxYZbQsNJMgiY/Q==","mode":420,"size":2192},"index.js":{"checkedAt":1707919832841,"integrity":"sha512-ctVBvIN2C6LMnjVDZYisyi3ozSTdXz+ElSBZVTiG9HxWnMIBjkwdhzN+iVpv7i280HtxlpQarG2YnJOUbbqyPQ==","mode":420,"size":3932},"package.json":{"checkedAt":1707919832841,"integrity":"sha512-bgiB92sryXzalNTEQBo7KDCeooWewwLVHSAhbxQaM0pS1LeU8MKSpHnnpUNVfEgbE38vuvfClXEGA3d5/WPCiw==","mode":420,"size":1115},"README.md":{"checkedAt":1707919832841,"integrity":"sha512-qBXzUl7ymDXg/jfl8cMwrkX+R2J+Oa9RK4Ky0hvNmH1jqM0b4Tj/aRXhqm5oBrQb7bmbmOD3qbqMuYQzhATdVA==","mode":420,"size":1143},"index.d.ts":{"checkedAt":1707919832842,"integrity":"sha512-+SNpuNuS/szaUzwsef9DCvIgZ/oqDKTJTmJEwLCgcacLJfk53ww1UKLRfondTTL8EhUxtmwAUSxgyXBZb93pHA==","mode":420,"size":161}}}
|
|
@ -0,0 +1,118 @@
|
|||
import { temporarilySilenceLogs } from "@changesets/test-utils";
|
||||
import getDependencyGraph from "./get-dependency-graph";
|
||||
|
||||
const consoleError = console.error;
|
||||
|
||||
beforeEach(() => {
|
||||
console.error = jest.fn();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
console.error = consoleError;
|
||||
});
|
||||
|
||||
describe("getting the dependency graph", function () {
|
||||
it("should skip dependencies specified through the link protocol", function () {
|
||||
const { graph, valid } = getDependencyGraph({
|
||||
root: {
|
||||
dir: ".",
|
||||
packageJson: { name: "root", version: "1.0.0" },
|
||||
},
|
||||
packages: [
|
||||
{
|
||||
dir: "foo",
|
||||
packageJson: {
|
||||
name: "foo",
|
||||
version: "1.0.0",
|
||||
devDependencies: {
|
||||
bar: "link:../bar",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
dir: "bar",
|
||||
packageJson: {
|
||||
name: "bar",
|
||||
version: "1.0.0",
|
||||
},
|
||||
},
|
||||
],
|
||||
tool: "pnpm",
|
||||
});
|
||||
expect(graph.get("foo")!.dependencies).toStrictEqual([]);
|
||||
expect(valid).toBeTruthy();
|
||||
expect((console.error as any).mock.calls).toMatchInlineSnapshot(`[]`);
|
||||
});
|
||||
|
||||
it("should skip dependencies specified using a tag", function () {
|
||||
const { graph, valid } = getDependencyGraph({
|
||||
root: {
|
||||
dir: ".",
|
||||
packageJson: { name: "root", version: "1.0.0" },
|
||||
},
|
||||
packages: [
|
||||
{
|
||||
dir: "examples/foo",
|
||||
packageJson: {
|
||||
name: "foo-example",
|
||||
version: "1.0.0",
|
||||
dependencies: {
|
||||
bar: "latest",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
dir: "packages/bar",
|
||||
packageJson: {
|
||||
name: "bar",
|
||||
version: "1.0.0",
|
||||
},
|
||||
},
|
||||
],
|
||||
tool: "pnpm",
|
||||
});
|
||||
expect(graph.get("foo-example")!.dependencies).toStrictEqual([]);
|
||||
expect(valid).toBeTruthy();
|
||||
expect((console.error as any).mock.calls).toMatchInlineSnapshot(`[]`);
|
||||
});
|
||||
|
||||
it(
|
||||
"should set valid to false if the link protocol is used in a non-dev dep",
|
||||
temporarilySilenceLogs(() => {
|
||||
const { valid } = getDependencyGraph({
|
||||
root: {
|
||||
dir: ".",
|
||||
packageJson: { name: "root", version: "1.0.0" },
|
||||
},
|
||||
packages: [
|
||||
{
|
||||
dir: "foo",
|
||||
packageJson: {
|
||||
name: "foo",
|
||||
version: "1.0.0",
|
||||
dependencies: {
|
||||
bar: "link:../bar",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
dir: "bar",
|
||||
packageJson: {
|
||||
name: "bar",
|
||||
version: "1.0.0",
|
||||
},
|
||||
},
|
||||
],
|
||||
tool: "pnpm",
|
||||
});
|
||||
expect(valid).toBeFalsy();
|
||||
expect((console.error as any).mock.calls).toMatchInlineSnapshot(`
|
||||
[
|
||||
[
|
||||
"Package [36m"foo"[39m must depend on the current version of [36m"bar"[39m: [32m"1.0.0"[39m vs [31m"link:../bar"[39m",
|
||||
],
|
||||
]
|
||||
`);
|
||||
})
|
||||
);
|
||||
});
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
var _types = require("./types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var Nesting = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Nesting, _Node);
|
||||
function Nesting(opts) {
|
||||
var _this;
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.NESTING;
|
||||
_this.value = '&';
|
||||
return _this;
|
||||
}
|
||||
return Nesting;
|
||||
}(_node["default"]);
|
||||
exports["default"] = Nesting;
|
||||
module.exports = exports.default;
|
|
@ -0,0 +1,11 @@
|
|||
# @unocss/preset-wind
|
||||
|
||||
Tailwind / Windi CSS compact preset for [UnoCSS](https://github.com/unocss/unocss).
|
||||
|
||||
## Documentation
|
||||
|
||||
Please refer to the [documentation](https://unocss.dev/presets/wind).
|
||||
|
||||
## License
|
||||
|
||||
MIT License © 2021-PRESENT [Anthony Fu](https://github.com/antfu)
|
|
@ -0,0 +1,76 @@
|
|||
import { isNode } from '../nodes/identity.js';
|
||||
import { Scalar } from '../nodes/Scalar.js';
|
||||
import { YAMLMap } from '../nodes/YAMLMap.js';
|
||||
import { YAMLSeq } from '../nodes/YAMLSeq.js';
|
||||
import { resolveBlockMap } from './resolve-block-map.js';
|
||||
import { resolveBlockSeq } from './resolve-block-seq.js';
|
||||
import { resolveFlowCollection } from './resolve-flow-collection.js';
|
||||
|
||||
function resolveCollection(CN, ctx, token, onError, tagName, tag) {
|
||||
const coll = token.type === 'block-map'
|
||||
? resolveBlockMap(CN, ctx, token, onError, tag)
|
||||
: token.type === 'block-seq'
|
||||
? resolveBlockSeq(CN, ctx, token, onError, tag)
|
||||
: resolveFlowCollection(CN, ctx, token, onError, tag);
|
||||
const Coll = coll.constructor;
|
||||
// If we got a tagName matching the class, or the tag name is '!',
|
||||
// then use the tagName from the node class used to create it.
|
||||
if (tagName === '!' || tagName === Coll.tagName) {
|
||||
coll.tag = Coll.tagName;
|
||||
return coll;
|
||||
}
|
||||
if (tagName)
|
||||
coll.tag = tagName;
|
||||
return coll;
|
||||
}
|
||||
function composeCollection(CN, ctx, token, tagToken, onError) {
|
||||
const tagName = !tagToken
|
||||
? null
|
||||
: ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
|
||||
const expType = token.type === 'block-map'
|
||||
? 'map'
|
||||
: token.type === 'block-seq'
|
||||
? 'seq'
|
||||
: token.start.source === '{'
|
||||
? 'map'
|
||||
: 'seq';
|
||||
// shortcut: check if it's a generic YAMLMap or YAMLSeq
|
||||
// before jumping into the custom tag logic.
|
||||
if (!tagToken ||
|
||||
!tagName ||
|
||||
tagName === '!' ||
|
||||
(tagName === YAMLMap.tagName && expType === 'map') ||
|
||||
(tagName === YAMLSeq.tagName && expType === 'seq') ||
|
||||
!expType) {
|
||||
return resolveCollection(CN, ctx, token, onError, tagName);
|
||||
}
|
||||
let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
|
||||
if (!tag) {
|
||||
const kt = ctx.schema.knownTags[tagName];
|
||||
if (kt && kt.collection === expType) {
|
||||
ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
|
||||
tag = kt;
|
||||
}
|
||||
else {
|
||||
if (kt?.collection) {
|
||||
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
|
||||
}
|
||||
else {
|
||||
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
|
||||
}
|
||||
return resolveCollection(CN, ctx, token, onError, tagName);
|
||||
}
|
||||
}
|
||||
const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);
|
||||
const res = tag.resolve?.(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options) ?? coll;
|
||||
const node = isNode(res)
|
||||
? res
|
||||
: new Scalar(res);
|
||||
node.range = coll.range;
|
||||
node.tag = tagName;
|
||||
if (tag?.format)
|
||||
node.format = tag.format;
|
||||
return node;
|
||||
}
|
||||
|
||||
export { composeCollection };
|
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $BigInt = GetIntrinsic('%BigInt%', true);
|
||||
var $RangeError = GetIntrinsic('%RangeError%');
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var Type = require('../Type');
|
||||
|
||||
var zero = $BigInt && $BigInt(0);
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-remainder
|
||||
|
||||
module.exports = function BigIntRemainder(n, d) {
|
||||
if (Type(n) !== 'BigInt' || Type(d) !== 'BigInt') {
|
||||
throw new $TypeError('Assertion failed: `n` and `d` arguments must be BigInts');
|
||||
}
|
||||
|
||||
if (d === zero) {
|
||||
throw new $RangeError('Division by zero');
|
||||
}
|
||||
|
||||
if (n === zero) {
|
||||
return zero;
|
||||
}
|
||||
|
||||
// shortcut for the actual spec mechanics
|
||||
return n % d;
|
||||
};
|
|
@ -0,0 +1,198 @@
|
|||
export function visit<Tree extends import('unist').Node, Check extends Test>(
|
||||
tree: Tree,
|
||||
check: Check,
|
||||
visitor: BuildVisitor<Tree, Check>,
|
||||
reverse?: boolean | null | undefined
|
||||
): undefined
|
||||
export function visit<Tree extends import('unist').Node, Check extends Test>(
|
||||
tree: Tree,
|
||||
visitor: BuildVisitor<Tree, Test>,
|
||||
reverse?: boolean | null | undefined
|
||||
): undefined
|
||||
export type UnistNode = import('unist').Node
|
||||
export type UnistParent = import('unist').Parent
|
||||
export type VisitorResult = import('unist-util-visit-parents').VisitorResult
|
||||
/**
|
||||
* Test from `unist-util-is`.
|
||||
*
|
||||
* Note: we have remove and add `undefined`, because otherwise when generating
|
||||
* automatic `.d.ts` files, TS tries to flatten paths from a local perspective,
|
||||
* which doesn’t work when publishing on npm.
|
||||
*/
|
||||
export type Test = Exclude<import('unist-util-is').Test, undefined> | undefined
|
||||
/**
|
||||
* Get the value of a type guard `Fn`.
|
||||
*/
|
||||
export type Predicate<Fn, Fallback> = Fn extends (
|
||||
value: any
|
||||
) => value is infer Thing
|
||||
? Thing
|
||||
: Fallback
|
||||
/**
|
||||
* Check whether a node matches a primitive check in the type system.
|
||||
*/
|
||||
export type MatchesOne<Value, Check> = Check extends null | undefined
|
||||
? Value
|
||||
: Value extends {
|
||||
type: Check
|
||||
}
|
||||
? Value
|
||||
: Value extends Check
|
||||
? Value
|
||||
: Check extends Function
|
||||
? Predicate<Check, Value> extends Value
|
||||
? Predicate<Check, Value>
|
||||
: never
|
||||
: never
|
||||
/**
|
||||
* Check whether a node matches a check in the type system.
|
||||
*/
|
||||
export type Matches<Value, Check> = Check extends Array<any>
|
||||
? MatchesOne<Value, Check[keyof Check]>
|
||||
: MatchesOne<Value, Check>
|
||||
/**
|
||||
* Number; capped reasonably.
|
||||
*/
|
||||
export type Uint = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
|
||||
/**
|
||||
* Increment a number in the type system.
|
||||
*/
|
||||
export type Increment<I extends Uint = 0> = I extends 0
|
||||
? 1
|
||||
: I extends 1
|
||||
? 2
|
||||
: I extends 2
|
||||
? 3
|
||||
: I extends 3
|
||||
? 4
|
||||
: I extends 4
|
||||
? 5
|
||||
: I extends 5
|
||||
? 6
|
||||
: I extends 6
|
||||
? 7
|
||||
: I extends 7
|
||||
? 8
|
||||
: I extends 8
|
||||
? 9
|
||||
: 10
|
||||
/**
|
||||
* Collect nodes that can be parents of `Child`.
|
||||
*/
|
||||
export type InternalParent<
|
||||
Node extends import('unist').Node,
|
||||
Child extends import('unist').Node
|
||||
> = Node extends import('unist').Parent
|
||||
? Node extends {
|
||||
children: (infer Children)[]
|
||||
}
|
||||
? Child extends Children
|
||||
? Node
|
||||
: never
|
||||
: never
|
||||
: never
|
||||
/**
|
||||
* Collect nodes in `Tree` that can be parents of `Child`.
|
||||
*/
|
||||
export type Parent<
|
||||
Tree extends import('unist').Node,
|
||||
Child extends import('unist').Node
|
||||
> = InternalParent<InclusiveDescendant<Tree>, Child>
|
||||
/**
|
||||
* Collect nodes in `Tree` that can be ancestors of `Child`.
|
||||
*/
|
||||
export type InternalAncestor<
|
||||
Node extends import('unist').Node,
|
||||
Child extends import('unist').Node,
|
||||
Max extends Uint = 10,
|
||||
Depth extends Uint = 0
|
||||
> = Depth extends Max
|
||||
? never
|
||||
:
|
||||
| InternalParent<Node, Child>
|
||||
| InternalAncestor<
|
||||
Node,
|
||||
InternalParent<Node, Child>,
|
||||
Max,
|
||||
Increment<Depth>
|
||||
>
|
||||
/**
|
||||
* Collect all (inclusive) descendants of `Tree`.
|
||||
*
|
||||
* > 👉 **Note**: for performance reasons, this seems to be the fastest way to
|
||||
* > recurse without actually running into an infinite loop, which the
|
||||
* > previous version did.
|
||||
* >
|
||||
* > Practically, a max of `2` is typically enough assuming a `Root` is
|
||||
* > passed, but it doesn’t improve performance.
|
||||
* > It gets higher with `List > ListItem > Table > TableRow > TableCell`.
|
||||
* > Using up to `10` doesn’t hurt or help either.
|
||||
*/
|
||||
export type InclusiveDescendant<
|
||||
Tree extends import('unist').Node,
|
||||
Max extends Uint = 10,
|
||||
Depth extends Uint = 0
|
||||
> = Tree extends UnistParent
|
||||
? Depth extends Max
|
||||
? Tree
|
||||
:
|
||||
| Tree
|
||||
| InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>
|
||||
: Tree
|
||||
/**
|
||||
* Handle a node (matching `test`, if given).
|
||||
*
|
||||
* Visitors are free to transform `node`.
|
||||
* They can also transform `parent`.
|
||||
*
|
||||
* Replacing `node` itself, if `SKIP` is not returned, still causes its
|
||||
* descendants to be walked (which is a bug).
|
||||
*
|
||||
* When adding or removing previous siblings of `node` (or next siblings, in
|
||||
* case of reverse), the `Visitor` should return a new `Index` to specify the
|
||||
* sibling to traverse after `node` is traversed.
|
||||
* Adding or removing next siblings of `node` (or previous siblings, in case
|
||||
* of reverse) is handled as expected without needing to return a new `Index`.
|
||||
*
|
||||
* Removing the children property of `parent` still results in them being
|
||||
* traversed.
|
||||
*/
|
||||
export type Visitor<
|
||||
Visited extends import('unist').Node = import('unist').Node,
|
||||
Ancestor extends import('unist').Parent = import('unist').Parent
|
||||
> = (
|
||||
node: Visited,
|
||||
index: Visited extends UnistNode ? number | undefined : never,
|
||||
parent: Ancestor extends UnistParent ? Ancestor | undefined : never
|
||||
) => VisitorResult
|
||||
/**
|
||||
* Build a typed `Visitor` function from a node and all possible parents.
|
||||
*
|
||||
* It will infer which values are passed as `node` and which as `parent`.
|
||||
*/
|
||||
export type BuildVisitorFromMatch<
|
||||
Visited extends import('unist').Node,
|
||||
Ancestor extends import('unist').Parent
|
||||
> = Visitor<Visited, Parent<Ancestor, Visited>>
|
||||
/**
|
||||
* Build a typed `Visitor` function from a list of descendants and a test.
|
||||
*
|
||||
* It will infer which values are passed as `node` and which as `parent`.
|
||||
*/
|
||||
export type BuildVisitorFromDescendants<
|
||||
Descendant extends import('unist').Node,
|
||||
Check extends Test
|
||||
> = BuildVisitorFromMatch<
|
||||
Matches<Descendant, Check>,
|
||||
Extract<Descendant, UnistParent>
|
||||
>
|
||||
/**
|
||||
* Build a typed `Visitor` function from a tree and a test.
|
||||
*
|
||||
* It will infer which values are passed as `node` and which as `parent`.
|
||||
*/
|
||||
export type BuildVisitor<
|
||||
Tree extends import('unist').Node = import('unist').Node,
|
||||
Check extends Test = Test
|
||||
> = BuildVisitorFromDescendants<InclusiveDescendant<Tree>, Check>
|
||||
export {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'
|
|
@ -0,0 +1,2 @@
|
|||
import { type LogMessage, type LogWritable } from './core.js';
|
||||
export declare const consoleLogDestination: LogWritable<LogMessage>;
|
|
@ -0,0 +1,7 @@
|
|||
import type * as vite from 'vite';
|
||||
import type { AstroSettings } from '../@types/astro.js';
|
||||
interface EnvPluginOptions {
|
||||
settings: AstroSettings;
|
||||
}
|
||||
export default function envVitePlugin({ settings }: EnvPluginOptions): vite.Plugin;
|
||||
export {};
|
|
@ -0,0 +1,99 @@
|
|||
### Sass Formatter
|
||||
|
||||
<span id="BADGE_GENERATION_MARKER_0"></span>
|
||||
[](https://github.com/facebook/jest) [](https://www.codefactor.io/repository/github/therealsyler/sass-formatter) [](https://github.com/TheRealSyler/sass-formatter/actions/workflows/main.yml) [](https://codecov.io/gh/TheRealSyler/sass-formatter) [](https://www.npmjs.com/package/sass-formatter) [](https://bundlephobia.com/result?p=sass-formatter) [](https://packagephobia.now.sh/result?p=sass-formatter) [](https://github.com/TheRealSyler/sass-formatter)
|
||||
<span id="BADGE_GENERATION_MARKER_1"></span>
|
||||
|
||||
### Website [sass-formatter.syler.de](https://sass-formatter.syler.de/)
|
||||
## Used in
|
||||
* [Vscode sass extension](https://github.com/TheRealSyler/vscode-sass-indented)
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { SassFormatter } from 'sass-formatter';
|
||||
|
||||
const result = SassFormatter.Format(
|
||||
`
|
||||
span
|
||||
color: none
|
||||
|
||||
@for $i from 0 through 2
|
||||
|
||||
&:nth-child(#{$i})
|
||||
color: none
|
||||
@each $author in $list
|
||||
.photo-#{$author}
|
||||
background: image-url("avatars/#{$author}.png") no-repeat
|
||||
|
||||
@while $types > 0
|
||||
.while-#{$types}
|
||||
width: $type-width + $types`
|
||||
);
|
||||
```
|
||||
|
||||
#### Result
|
||||
|
||||
```sass
|
||||
span
|
||||
color: none
|
||||
|
||||
@for $i from 0 through 2
|
||||
|
||||
&:nth-child(#{$i})
|
||||
color: none
|
||||
@each $author in $list
|
||||
.photo-#{$author}
|
||||
background: image-url("avatars/#{$author}.png") no-repeat
|
||||
|
||||
@while $types > 0
|
||||
.while-#{$types}
|
||||
width: $type-width + $types
|
||||
```
|
||||
|
||||
<span id="DOC_GENERATION_MARKER_0"></span>
|
||||
|
||||
# Docs
|
||||
|
||||
- **[config](#config)**
|
||||
|
||||
- [SassFormatterConfig](#sassformatterconfig)
|
||||
- [defaultSassFormatterConfig](#defaultsassformatterconfig)
|
||||
|
||||
### config
|
||||
|
||||
##### SassFormatterConfig
|
||||
|
||||
```ts
|
||||
interface SassFormatterConfig {
|
||||
/**Enable debug messages */
|
||||
debug: boolean;
|
||||
/**delete rows that are empty. */
|
||||
deleteEmptyRows: boolean;
|
||||
/**@deprecated*/
|
||||
deleteWhitespace: boolean;
|
||||
/**Convert css or scss to sass */
|
||||
convert: boolean;
|
||||
/**set the space after the colon of a property to one.*/
|
||||
setPropertySpace: boolean;
|
||||
tabSize: number;
|
||||
/**insert spaces or tabs. */
|
||||
insertSpaces: boolean;
|
||||
/**Defaults to LF*/
|
||||
lineEnding: 'LF' | 'CRLF';
|
||||
}
|
||||
```
|
||||
|
||||
##### defaultSassFormatterConfig
|
||||
|
||||
```ts
|
||||
const defaultSassFormatterConfig: SassFormatterConfig;
|
||||
```
|
||||
|
||||
_Generated with_ **[suf-cli](https://www.npmjs.com/package/suf-cli)**
|
||||
<span id="DOC_GENERATION_MARKER_1"></span>
|
||||
|
||||
## License
|
||||
|
||||
<span id="LICENSE_GENERATION_MARKER_0"></span>
|
||||
Copyright (c) 2019 Leonard Grosoli Licensed under the MIT license.
|
||||
<span id="LICENSE_GENERATION_MARKER_1"></span>
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* Use the default user interface font in all browsers (opinionated).
|
||||
*/
|
||||
|
||||
html {
|
||||
font-family:
|
||||
system-ui,
|
||||
/* macOS 10.11-10.12 */ -apple-system,
|
||||
/* Windows 6+ */ "Segoe UI",
|
||||
/* Android 4+ */ "Roboto",
|
||||
/* Ubuntu 10.10+ */ "Ubuntu",
|
||||
/* Gnome 3+ */ "Cantarell",
|
||||
/* KDE Plasma 5+ */ "Noto Sans",
|
||||
/* fallback */ sans-serif,
|
||||
/* macOS emoji */ "Apple Color Emoji",
|
||||
/* Windows emoji */ "Segoe UI Emoji",
|
||||
/* Windows emoji */ "Segoe UI Symbol",
|
||||
/* Linux emoji */ "Noto Color Emoji";
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the default monospace user interface font in all browsers (opinionated).
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
samp,
|
||||
pre {
|
||||
font-family:
|
||||
ui-monospace,
|
||||
/* macOS 10.10+ */ "Menlo",
|
||||
/* Windows 6+ */ "Consolas",
|
||||
/* Android 4+ */ "Roboto Mono",
|
||||
/* Ubuntu 10.10+ */ "Ubuntu Monospace",
|
||||
/* KDE Plasma 5+ */ "Noto Mono",
|
||||
/* KDE Plasma 4+ */ "Oxygen Mono",
|
||||
/* Linux/OpenOffice fallback */ "Liberation Mono",
|
||||
/* fallback */ monospace,
|
||||
/* macOS emoji */ "Apple Color Emoji",
|
||||
/* Windows emoji */ "Segoe UI Emoji",
|
||||
/* Windows emoji */ "Segoe UI Symbol",
|
||||
/* Linux emoji */ "Noto Color Emoji";
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
import type {DelimiterCasedProperties} from './delimiter-cased-properties';
|
||||
|
||||
/**
|
||||
Convert object properties to snake case but not recursively.
|
||||
|
||||
This can be useful when, for example, converting some API types from a different style.
|
||||
|
||||
@see SnakeCase
|
||||
@see SnakeCasedPropertiesDeep
|
||||
|
||||
@example
|
||||
```
|
||||
import type {SnakeCasedProperties} from 'type-fest';
|
||||
|
||||
interface User {
|
||||
userId: number;
|
||||
userName: string;
|
||||
}
|
||||
|
||||
const result: SnakeCasedProperties<User> = {
|
||||
user_id: 1,
|
||||
user_name: 'Tom',
|
||||
};
|
||||
```
|
||||
|
||||
@category Change case
|
||||
@category Template literal
|
||||
@category Object
|
||||
*/
|
||||
export type SnakeCasedProperties<Value> = DelimiterCasedProperties<Value, '_'>;
|
|
@ -0,0 +1,28 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var navigationRole = {
|
||||
abstract: false,
|
||||
accessibleNameRequired: false,
|
||||
baseConcepts: [],
|
||||
childrenPresentational: false,
|
||||
nameFrom: ['author'],
|
||||
prohibitedProps: [],
|
||||
props: {},
|
||||
relatedConcepts: [{
|
||||
concept: {
|
||||
name: 'nav'
|
||||
},
|
||||
module: 'HTML'
|
||||
}],
|
||||
requireContextRole: [],
|
||||
requiredContextRole: [],
|
||||
requiredOwnedElements: [],
|
||||
requiredProps: {},
|
||||
superClass: [['roletype', 'structure', 'section', 'landmark']]
|
||||
};
|
||||
var _default = navigationRole;
|
||||
exports.default = _default;
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>UnoCSS Inspector</title>
|
||||
<link rel="icon" href="/__unocss/favicon.svg" type="image/svg+xml">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;400&family=Fira+Code&display=swap" rel="stylesheet" />
|
||||
<script type="module" crossorigin src="/__unocss/assets/index-44yCo4Ah.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/__unocss/assets/index-Py9RA6Gg.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,44 @@
|
|||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var flatted = require('flatted');
|
||||
|
||||
module.exports = {
|
||||
tryParse: function (filePath, defaultValue) {
|
||||
var result;
|
||||
try {
|
||||
result = this.readJSON(filePath);
|
||||
} catch (ex) {
|
||||
result = defaultValue;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
* Read json file synchronously using flatted
|
||||
*
|
||||
* @method readJSON
|
||||
* @param {String} filePath Json filepath
|
||||
* @returns {*} parse result
|
||||
*/
|
||||
readJSON: function (filePath) {
|
||||
return flatted.parse(
|
||||
fs.readFileSync(filePath, {
|
||||
encoding: 'utf8',
|
||||
})
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Write json file synchronously using circular-json
|
||||
*
|
||||
* @method writeJSON
|
||||
* @param {String} filePath Json filepath
|
||||
* @param {*} data Object to serialize
|
||||
*/
|
||||
writeJSON: function (filePath, data) {
|
||||
fs.mkdirSync(path.dirname(filePath), {
|
||||
recursive: true,
|
||||
});
|
||||
fs.writeFileSync(filePath, flatted.stringify(data));
|
||||
},
|
||||
};
|
|
@ -0,0 +1,89 @@
|
|||
# has-flag [](https://travis-ci.org/sindresorhus/has-flag)
|
||||
|
||||
> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag
|
||||
|
||||
Correctly stops looking after an `--` argument terminator.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-has-flag?utm_source=npm-has-flag&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install has-flag
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// foo.js
|
||||
const hasFlag = require('has-flag');
|
||||
|
||||
hasFlag('unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('--unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('f');
|
||||
//=> true
|
||||
|
||||
hasFlag('-f');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo=bar');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo');
|
||||
//=> false
|
||||
|
||||
hasFlag('rainbow');
|
||||
//=> false
|
||||
```
|
||||
|
||||
```
|
||||
$ node foo.js -f --unicorn --foo=bar -- --rainbow
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### hasFlag(flag, [argv])
|
||||
|
||||
Returns a boolean for whether the flag exists.
|
||||
|
||||
#### flag
|
||||
|
||||
Type: `string`
|
||||
|
||||
CLI flag to look for. The `--` prefix is optional.
|
||||
|
||||
#### argv
|
||||
|
||||
Type: `string[]`<br>
|
||||
Default: `process.argv`
|
||||
|
||||
CLI arguments.
|
||||
|
||||
|
||||
## Security
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"name": "get-symbol-description",
|
||||
"version": "1.0.0",
|
||||
"description": "Gets the description of a Symbol. Handles `Symbol()` vs `Symbol('')` properly when possible.",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./getInferredName": "./getInferredName.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"lint": "eslint --ext=.js,.mjs .",
|
||||
"postlint": "evalmd README.md",
|
||||
"pretest": "npm run lint",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/inspect-js/get-symbol-description.git"
|
||||
},
|
||||
"keywords": [
|
||||
"symbol",
|
||||
"ecmascript",
|
||||
"javascript",
|
||||
"description"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/inspect-js/get-symbol-description/issues"
|
||||
},
|
||||
"homepage": "https://github.com/inspect-js/get-symbol-description#readme",
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"get-intrinsic": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^17.6.0",
|
||||
"aud": "^1.1.5",
|
||||
"auto-changelog": "^2.3.0",
|
||||
"es-value-fixtures": "^1.2.1",
|
||||
"eslint": "^7.32.0",
|
||||
"evalmd": "^0.0.19",
|
||||
"foreach": "^2.0.5",
|
||||
"has": "^1.0.3",
|
||||
"nyc": "^10.3.2",
|
||||
"object-inspect": "^1.11.0",
|
||||
"safe-publish-latest": "^1.1.4",
|
||||
"tape": "^5.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{"files":{"LICENSE":{"checkedAt":1707919832683,"integrity":"sha512-Ca6s7X2ZfTI6fGB3faWEyIGYcJajB9jLXcw0mcKJ0htY9zs6HW2o8jDnuqZOv4yfJt5kw4rAh0tRhzlxKM6raQ==","mode":420,"size":753},"index.js":{"checkedAt":1707919832683,"integrity":"sha512-d7dN81urIl+AgVs+2rwo/aIBVYRzVrIutDMsHVgiDEojj7sprmx818+3e8IPt8QT8WZfiDHqPJvK0Yc/zsZ1LQ==","mode":420,"size":1120},"package.json":{"checkedAt":1707919832683,"integrity":"sha512-1clKscMLzwwOqg6cKj8agX7y5kyTU2w6v4vDWsQHz6sx9174OZCudhecNKUYrsSES3vaigPFd36vERycoWZjPQ==","mode":420,"size":1105},"CHANGELOG.md":{"checkedAt":1707919832683,"integrity":"sha512-dHv9RnK7Jt8LHdXB7DJnpHZdTYF8/CqeW6Q9n201h0zoVwQha4+b/1sKvlNNMjcSC3b3D/P7CQfqcgGoPrZKZg==","mode":420,"size":4510},"README.md":{"checkedAt":1707919832683,"integrity":"sha512-mj6hcRQBOumgjqcf8pAQpY3tuJKKiqPLOH3xMiRRzjRKuQ5zgmzUTV/KtbFs3+8EI9a1tasZTG/QbJPAVDWeyw==","mode":420,"size":4646}}}
|
|
@ -0,0 +1 @@
|
|||
module.exports={A:{A:{"2":"J D E F A B RC"},B:{"1":"0 1 2 3 4 5 6 7 8 C K L G M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p w x y z q H"},C:{"1":"0 1 2 3 4 5 6 7 8 RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB 7B kB 8B lB mB nB oB pB qB rB sB tB uB vB v wB xB yB zB 0B P Q R 9B S T U V W X Y Z a b c d e f g h i j k l m n o p w x y z q H AC BC TC","2":"9 SC 6B I J D E F A B C K L G M N O AB r s t u BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB UC VC"},D:{"1":"0 1 2 3 4 5 6 7 8 SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB 7B kB 8B lB mB nB oB pB qB rB sB tB uB vB v wB xB yB zB 0B P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p w x y z q H AC BC","2":"9 I J D E F A B C K L G M N O AB r s t u BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB"},E:{"1":"F A B C K L G aC DC 1B 2B EC bC cC FC GC 3B dC 4B HC IC JC KC LC eC 5B MC NC OC fC","2":"9 I J D E WC CC XC YC ZC"},F:{"1":"FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB v wB xB yB zB 0B P Q R 9B S T U V W X Y Z a b c d e f g h i j k l m n o p","2":"F B C G M N O AB r s t u BB CB DB EB gC hC iC jC 1B PC kC 2B"},G:{"1":"qC rC sC tC uC vC wC xC yC zC 0C 1C 2C 3C 4C FC GC 3B 5C 4B HC IC JC KC LC 6C 5B MC NC OC","2":"E CC lC QC mC nC oC pC"},H:{"2":"7C"},I:{"1":"H","2":"6B I 8C 9C AD BD QC CD DD"},J:{"2":"D A"},K:{"1":"v","2":"A B C 1B PC 2B"},L:{"1":"H"},M:{"1":"q"},N:{"2":"A B"},O:{"1":"3B"},P:{"1":"I r s t u ED FD GD HD ID DC JD KD LD MD ND 4B 5B OD PD"},Q:{"1":"EC"},R:{"1":"QD"},S:{"1":"RD SD"}},B:6,C:"String.prototype.includes",D:true};
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"es2023.js","sourceRoot":"","sources":["../../src/lib/es2023.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,mEAAmE;AACnE,uDAAuD;;;AAGvD,qCAAkC;AAClC,iDAA8C;AAEjC,QAAA,MAAM,GAAG,gCACjB,eAAM,GACN,2BAAY,CAC8B,CAAC"}
|
|
@ -0,0 +1,2 @@
|
|||
export { ValueError, ValueErrorType } from '../errors/index';
|
||||
export * from './compiler';
|
|
@ -0,0 +1,67 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.cryptoRuntime = exports.base64url = exports.generateSecret = exports.generateKeyPair = exports.errors = exports.decodeJwt = exports.decodeProtectedHeader = exports.importJWK = exports.importX509 = exports.importPKCS8 = exports.importSPKI = exports.exportJWK = exports.exportSPKI = exports.exportPKCS8 = exports.UnsecuredJWT = exports.createRemoteJWKSet = exports.createLocalJWKSet = exports.EmbeddedJWK = exports.calculateJwkThumbprintUri = exports.calculateJwkThumbprint = exports.EncryptJWT = exports.SignJWT = exports.GeneralSign = exports.FlattenedSign = exports.CompactSign = exports.FlattenedEncrypt = exports.CompactEncrypt = exports.jwtDecrypt = exports.jwtVerify = exports.generalVerify = exports.flattenedVerify = exports.compactVerify = exports.GeneralEncrypt = exports.generalDecrypt = exports.flattenedDecrypt = exports.compactDecrypt = void 0;
|
||||
var decrypt_js_1 = require("./jwe/compact/decrypt.js");
|
||||
Object.defineProperty(exports, "compactDecrypt", { enumerable: true, get: function () { return decrypt_js_1.compactDecrypt; } });
|
||||
var decrypt_js_2 = require("./jwe/flattened/decrypt.js");
|
||||
Object.defineProperty(exports, "flattenedDecrypt", { enumerable: true, get: function () { return decrypt_js_2.flattenedDecrypt; } });
|
||||
var decrypt_js_3 = require("./jwe/general/decrypt.js");
|
||||
Object.defineProperty(exports, "generalDecrypt", { enumerable: true, get: function () { return decrypt_js_3.generalDecrypt; } });
|
||||
var encrypt_js_1 = require("./jwe/general/encrypt.js");
|
||||
Object.defineProperty(exports, "GeneralEncrypt", { enumerable: true, get: function () { return encrypt_js_1.GeneralEncrypt; } });
|
||||
var verify_js_1 = require("./jws/compact/verify.js");
|
||||
Object.defineProperty(exports, "compactVerify", { enumerable: true, get: function () { return verify_js_1.compactVerify; } });
|
||||
var verify_js_2 = require("./jws/flattened/verify.js");
|
||||
Object.defineProperty(exports, "flattenedVerify", { enumerable: true, get: function () { return verify_js_2.flattenedVerify; } });
|
||||
var verify_js_3 = require("./jws/general/verify.js");
|
||||
Object.defineProperty(exports, "generalVerify", { enumerable: true, get: function () { return verify_js_3.generalVerify; } });
|
||||
var verify_js_4 = require("./jwt/verify.js");
|
||||
Object.defineProperty(exports, "jwtVerify", { enumerable: true, get: function () { return verify_js_4.jwtVerify; } });
|
||||
var decrypt_js_4 = require("./jwt/decrypt.js");
|
||||
Object.defineProperty(exports, "jwtDecrypt", { enumerable: true, get: function () { return decrypt_js_4.jwtDecrypt; } });
|
||||
var encrypt_js_2 = require("./jwe/compact/encrypt.js");
|
||||
Object.defineProperty(exports, "CompactEncrypt", { enumerable: true, get: function () { return encrypt_js_2.CompactEncrypt; } });
|
||||
var encrypt_js_3 = require("./jwe/flattened/encrypt.js");
|
||||
Object.defineProperty(exports, "FlattenedEncrypt", { enumerable: true, get: function () { return encrypt_js_3.FlattenedEncrypt; } });
|
||||
var sign_js_1 = require("./jws/compact/sign.js");
|
||||
Object.defineProperty(exports, "CompactSign", { enumerable: true, get: function () { return sign_js_1.CompactSign; } });
|
||||
var sign_js_2 = require("./jws/flattened/sign.js");
|
||||
Object.defineProperty(exports, "FlattenedSign", { enumerable: true, get: function () { return sign_js_2.FlattenedSign; } });
|
||||
var sign_js_3 = require("./jws/general/sign.js");
|
||||
Object.defineProperty(exports, "GeneralSign", { enumerable: true, get: function () { return sign_js_3.GeneralSign; } });
|
||||
var sign_js_4 = require("./jwt/sign.js");
|
||||
Object.defineProperty(exports, "SignJWT", { enumerable: true, get: function () { return sign_js_4.SignJWT; } });
|
||||
var encrypt_js_4 = require("./jwt/encrypt.js");
|
||||
Object.defineProperty(exports, "EncryptJWT", { enumerable: true, get: function () { return encrypt_js_4.EncryptJWT; } });
|
||||
var thumbprint_js_1 = require("./jwk/thumbprint.js");
|
||||
Object.defineProperty(exports, "calculateJwkThumbprint", { enumerable: true, get: function () { return thumbprint_js_1.calculateJwkThumbprint; } });
|
||||
Object.defineProperty(exports, "calculateJwkThumbprintUri", { enumerable: true, get: function () { return thumbprint_js_1.calculateJwkThumbprintUri; } });
|
||||
var embedded_js_1 = require("./jwk/embedded.js");
|
||||
Object.defineProperty(exports, "EmbeddedJWK", { enumerable: true, get: function () { return embedded_js_1.EmbeddedJWK; } });
|
||||
var local_js_1 = require("./jwks/local.js");
|
||||
Object.defineProperty(exports, "createLocalJWKSet", { enumerable: true, get: function () { return local_js_1.createLocalJWKSet; } });
|
||||
var remote_js_1 = require("./jwks/remote.js");
|
||||
Object.defineProperty(exports, "createRemoteJWKSet", { enumerable: true, get: function () { return remote_js_1.createRemoteJWKSet; } });
|
||||
var unsecured_js_1 = require("./jwt/unsecured.js");
|
||||
Object.defineProperty(exports, "UnsecuredJWT", { enumerable: true, get: function () { return unsecured_js_1.UnsecuredJWT; } });
|
||||
var export_js_1 = require("./key/export.js");
|
||||
Object.defineProperty(exports, "exportPKCS8", { enumerable: true, get: function () { return export_js_1.exportPKCS8; } });
|
||||
Object.defineProperty(exports, "exportSPKI", { enumerable: true, get: function () { return export_js_1.exportSPKI; } });
|
||||
Object.defineProperty(exports, "exportJWK", { enumerable: true, get: function () { return export_js_1.exportJWK; } });
|
||||
var import_js_1 = require("./key/import.js");
|
||||
Object.defineProperty(exports, "importSPKI", { enumerable: true, get: function () { return import_js_1.importSPKI; } });
|
||||
Object.defineProperty(exports, "importPKCS8", { enumerable: true, get: function () { return import_js_1.importPKCS8; } });
|
||||
Object.defineProperty(exports, "importX509", { enumerable: true, get: function () { return import_js_1.importX509; } });
|
||||
Object.defineProperty(exports, "importJWK", { enumerable: true, get: function () { return import_js_1.importJWK; } });
|
||||
var decode_protected_header_js_1 = require("./util/decode_protected_header.js");
|
||||
Object.defineProperty(exports, "decodeProtectedHeader", { enumerable: true, get: function () { return decode_protected_header_js_1.decodeProtectedHeader; } });
|
||||
var decode_jwt_js_1 = require("./util/decode_jwt.js");
|
||||
Object.defineProperty(exports, "decodeJwt", { enumerable: true, get: function () { return decode_jwt_js_1.decodeJwt; } });
|
||||
exports.errors = require("./util/errors.js");
|
||||
var generate_key_pair_js_1 = require("./key/generate_key_pair.js");
|
||||
Object.defineProperty(exports, "generateKeyPair", { enumerable: true, get: function () { return generate_key_pair_js_1.generateKeyPair; } });
|
||||
var generate_secret_js_1 = require("./key/generate_secret.js");
|
||||
Object.defineProperty(exports, "generateSecret", { enumerable: true, get: function () { return generate_secret_js_1.generateSecret; } });
|
||||
exports.base64url = require("./util/base64url.js");
|
||||
var runtime_js_1 = require("./util/runtime.js");
|
||||
Object.defineProperty(exports, "cryptoRuntime", { enumerable: true, get: function () { return runtime_js_1.default; } });
|
|
@ -0,0 +1,4 @@
|
|||
import { default as default2 } from "../Prism.astro";
|
||||
export {
|
||||
default2 as Prism
|
||||
};
|
|
@ -0,0 +1,4 @@
|
|||
import type { ScalarTag } from '../types.js';
|
||||
export declare const intOct: ScalarTag;
|
||||
export declare const int: ScalarTag;
|
||||
export declare const intHex: ScalarTag;
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright 2022 Andrey Sitnik <andrey@sitnik.ru> and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,11 @@
|
|||
import subtleAlgorithm from './subtle_dsa.js';
|
||||
import crypto from './webcrypto.js';
|
||||
import checkKeyLength from './check_key_length.js';
|
||||
import getSignKey from './get_sign_verify_key.js';
|
||||
const sign = async (alg, key, data) => {
|
||||
const cryptoKey = await getSignKey(alg, key, 'sign');
|
||||
checkKeyLength(alg, cryptoKey);
|
||||
const signature = await crypto.subtle.sign(subtleAlgorithm(alg, cryptoKey.algorithm), cryptoKey, data);
|
||||
return new Uint8Array(signature);
|
||||
};
|
||||
export default sign;
|
|
@ -0,0 +1,217 @@
|
|||
import { Directives } from '../doc/directives.js';
|
||||
import { Document } from '../doc/Document.js';
|
||||
import { YAMLWarning, YAMLParseError } from '../errors.js';
|
||||
import { isCollection, isPair } from '../nodes/identity.js';
|
||||
import { composeDoc } from './compose-doc.js';
|
||||
import { resolveEnd } from './resolve-end.js';
|
||||
|
||||
function getErrorPos(src) {
|
||||
if (typeof src === 'number')
|
||||
return [src, src + 1];
|
||||
if (Array.isArray(src))
|
||||
return src.length === 2 ? src : [src[0], src[1]];
|
||||
const { offset, source } = src;
|
||||
return [offset, offset + (typeof source === 'string' ? source.length : 1)];
|
||||
}
|
||||
function parsePrelude(prelude) {
|
||||
let comment = '';
|
||||
let atComment = false;
|
||||
let afterEmptyLine = false;
|
||||
for (let i = 0; i < prelude.length; ++i) {
|
||||
const source = prelude[i];
|
||||
switch (source[0]) {
|
||||
case '#':
|
||||
comment +=
|
||||
(comment === '' ? '' : afterEmptyLine ? '\n\n' : '\n') +
|
||||
(source.substring(1) || ' ');
|
||||
atComment = true;
|
||||
afterEmptyLine = false;
|
||||
break;
|
||||
case '%':
|
||||
if (prelude[i + 1]?.[0] !== '#')
|
||||
i += 1;
|
||||
atComment = false;
|
||||
break;
|
||||
default:
|
||||
// This may be wrong after doc-end, but in that case it doesn't matter
|
||||
if (!atComment)
|
||||
afterEmptyLine = true;
|
||||
atComment = false;
|
||||
}
|
||||
}
|
||||
return { comment, afterEmptyLine };
|
||||
}
|
||||
/**
|
||||
* Compose a stream of CST nodes into a stream of YAML Documents.
|
||||
*
|
||||
* ```ts
|
||||
* import { Composer, Parser } from 'yaml'
|
||||
*
|
||||
* const src: string = ...
|
||||
* const tokens = new Parser().parse(src)
|
||||
* const docs = new Composer().compose(tokens)
|
||||
* ```
|
||||
*/
|
||||
class Composer {
|
||||
constructor(options = {}) {
|
||||
this.doc = null;
|
||||
this.atDirectives = false;
|
||||
this.prelude = [];
|
||||
this.errors = [];
|
||||
this.warnings = [];
|
||||
this.onError = (source, code, message, warning) => {
|
||||
const pos = getErrorPos(source);
|
||||
if (warning)
|
||||
this.warnings.push(new YAMLWarning(pos, code, message));
|
||||
else
|
||||
this.errors.push(new YAMLParseError(pos, code, message));
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
this.directives = new Directives({ version: options.version || '1.2' });
|
||||
this.options = options;
|
||||
}
|
||||
decorate(doc, afterDoc) {
|
||||
const { comment, afterEmptyLine } = parsePrelude(this.prelude);
|
||||
//console.log({ dc: doc.comment, prelude, comment })
|
||||
if (comment) {
|
||||
const dc = doc.contents;
|
||||
if (afterDoc) {
|
||||
doc.comment = doc.comment ? `${doc.comment}\n${comment}` : comment;
|
||||
}
|
||||
else if (afterEmptyLine || doc.directives.docStart || !dc) {
|
||||
doc.commentBefore = comment;
|
||||
}
|
||||
else if (isCollection(dc) && !dc.flow && dc.items.length > 0) {
|
||||
let it = dc.items[0];
|
||||
if (isPair(it))
|
||||
it = it.key;
|
||||
const cb = it.commentBefore;
|
||||
it.commentBefore = cb ? `${comment}\n${cb}` : comment;
|
||||
}
|
||||
else {
|
||||
const cb = dc.commentBefore;
|
||||
dc.commentBefore = cb ? `${comment}\n${cb}` : comment;
|
||||
}
|
||||
}
|
||||
if (afterDoc) {
|
||||
Array.prototype.push.apply(doc.errors, this.errors);
|
||||
Array.prototype.push.apply(doc.warnings, this.warnings);
|
||||
}
|
||||
else {
|
||||
doc.errors = this.errors;
|
||||
doc.warnings = this.warnings;
|
||||
}
|
||||
this.prelude = [];
|
||||
this.errors = [];
|
||||
this.warnings = [];
|
||||
}
|
||||
/**
|
||||
* Current stream status information.
|
||||
*
|
||||
* Mostly useful at the end of input for an empty stream.
|
||||
*/
|
||||
streamInfo() {
|
||||
return {
|
||||
comment: parsePrelude(this.prelude).comment,
|
||||
directives: this.directives,
|
||||
errors: this.errors,
|
||||
warnings: this.warnings
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Compose tokens into documents.
|
||||
*
|
||||
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
|
||||
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
|
||||
*/
|
||||
*compose(tokens, forceDoc = false, endOffset = -1) {
|
||||
for (const token of tokens)
|
||||
yield* this.next(token);
|
||||
yield* this.end(forceDoc, endOffset);
|
||||
}
|
||||
/** Advance the composer by one CST token. */
|
||||
*next(token) {
|
||||
switch (token.type) {
|
||||
case 'directive':
|
||||
this.directives.add(token.source, (offset, message, warning) => {
|
||||
const pos = getErrorPos(token);
|
||||
pos[0] += offset;
|
||||
this.onError(pos, 'BAD_DIRECTIVE', message, warning);
|
||||
});
|
||||
this.prelude.push(token.source);
|
||||
this.atDirectives = true;
|
||||
break;
|
||||
case 'document': {
|
||||
const doc = composeDoc(this.options, this.directives, token, this.onError);
|
||||
if (this.atDirectives && !doc.directives.docStart)
|
||||
this.onError(token, 'MISSING_CHAR', 'Missing directives-end/doc-start indicator line');
|
||||
this.decorate(doc, false);
|
||||
if (this.doc)
|
||||
yield this.doc;
|
||||
this.doc = doc;
|
||||
this.atDirectives = false;
|
||||
break;
|
||||
}
|
||||
case 'byte-order-mark':
|
||||
case 'space':
|
||||
break;
|
||||
case 'comment':
|
||||
case 'newline':
|
||||
this.prelude.push(token.source);
|
||||
break;
|
||||
case 'error': {
|
||||
const msg = token.source
|
||||
? `${token.message}: ${JSON.stringify(token.source)}`
|
||||
: token.message;
|
||||
const error = new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg);
|
||||
if (this.atDirectives || !this.doc)
|
||||
this.errors.push(error);
|
||||
else
|
||||
this.doc.errors.push(error);
|
||||
break;
|
||||
}
|
||||
case 'doc-end': {
|
||||
if (!this.doc) {
|
||||
const msg = 'Unexpected doc-end without preceding document';
|
||||
this.errors.push(new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg));
|
||||
break;
|
||||
}
|
||||
this.doc.directives.docEnd = true;
|
||||
const end = resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);
|
||||
this.decorate(this.doc, true);
|
||||
if (end.comment) {
|
||||
const dc = this.doc.comment;
|
||||
this.doc.comment = dc ? `${dc}\n${end.comment}` : end.comment;
|
||||
}
|
||||
this.doc.range[2] = end.offset;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
this.errors.push(new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', `Unsupported token ${token.type}`));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Call at end of input to yield any remaining document.
|
||||
*
|
||||
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
|
||||
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
|
||||
*/
|
||||
*end(forceDoc = false, endOffset = -1) {
|
||||
if (this.doc) {
|
||||
this.decorate(this.doc, true);
|
||||
yield this.doc;
|
||||
this.doc = null;
|
||||
}
|
||||
else if (forceDoc) {
|
||||
const opts = Object.assign({ _directives: this.directives }, this.options);
|
||||
const doc = new Document(undefined, opts);
|
||||
if (this.atDirectives)
|
||||
this.onError(endOffset, 'MISSING_CHAR', 'Missing directives-end indicator line');
|
||||
doc.range = [0, endOffset, endOffset];
|
||||
this.decorate(doc, false);
|
||||
yield doc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { Composer };
|
|
@ -0,0 +1,40 @@
|
|||
import { FileLike } from "./FileLike.js";
|
||||
/**
|
||||
* A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
|
||||
*/
|
||||
export type FormDataEntryValue = string | FileLike;
|
||||
/**
|
||||
* This interface reflects minimal shape of the FormData
|
||||
*/
|
||||
export interface FormDataLike {
|
||||
/**
|
||||
* Appends a new value onto an existing key inside a FormData object,
|
||||
* or adds the key if it does not already exist.
|
||||
*
|
||||
* The difference between `set()` and `append()` is that if the specified key already exists, `set()` will overwrite all existing values with the new one, whereas `append()` will append the new value onto the end of the existing set of values.
|
||||
*
|
||||
* @param name The name of the field whose data is contained in `value`.
|
||||
* @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
||||
or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
|
||||
* @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
|
||||
*/
|
||||
append(name: string, value: unknown, fileName?: string): void;
|
||||
/**
|
||||
* Returns all the values associated with a given key from within a `FormData` object.
|
||||
*
|
||||
* @param {string} name A name of the value you want to retrieve.
|
||||
*
|
||||
* @returns An array of `FormDataEntryValue` whose key matches the value passed in the `name` parameter. If the key doesn't exist, the method returns an empty list.
|
||||
*/
|
||||
getAll(name: string): FormDataEntryValue[];
|
||||
/**
|
||||
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs.
|
||||
* The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
|
||||
*/
|
||||
entries(): Generator<[string, FormDataEntryValue]>;
|
||||
/**
|
||||
* An alias for FormDataLike#entries()
|
||||
*/
|
||||
[Symbol.iterator](): Generator<[string, FormDataEntryValue]>;
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"name": "object-hash",
|
||||
"version": "3.0.0",
|
||||
"description": "Generate hashes from javascript objects in node and the browser.",
|
||||
"homepage": "https://github.com/puleos/object-hash",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/puleos/object-hash"
|
||||
},
|
||||
"keywords": [
|
||||
"object",
|
||||
"hash",
|
||||
"sha1",
|
||||
"md5"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/puleos/object-hash/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node ./node_modules/.bin/mocha test",
|
||||
"prepublish": "gulp dist"
|
||||
},
|
||||
"author": "Scott Puleo <puleos@gmail.com>",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist/object_hash.js"
|
||||
],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"browserify": "^16.2.3",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-browserify": "^0.5.1",
|
||||
"gulp-coveralls": "^0.1.4",
|
||||
"gulp-exec": "^3.0.1",
|
||||
"gulp-istanbul": "^1.1.3",
|
||||
"gulp-jshint": "^2.0.0",
|
||||
"gulp-mocha": "^5.0.0",
|
||||
"gulp-rename": "^1.2.0",
|
||||
"gulp-replace": "^1.0.0",
|
||||
"gulp-uglify": "^3.0.0",
|
||||
"jshint": "^2.8.0",
|
||||
"jshint-stylish": "^2.1.0",
|
||||
"karma": "^4.2.0",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"mocha": "^6.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"main": "./index.js",
|
||||
"browser": "./dist/object_hash.js"
|
||||
}
|
|
@ -0,0 +1,279 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.gatherLogicalOperands = void 0;
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const ts_api_utils_1 = require("ts-api-utils");
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util_1 = require("../../util");
|
||||
const NULLISH_FLAGS = ts.TypeFlags.Null | ts.TypeFlags.Undefined;
|
||||
function isValidFalseBooleanCheckType(node, operator, checkType, parserServices, options) {
|
||||
const type = parserServices.getTypeAtLocation(node);
|
||||
const types = (0, ts_api_utils_1.unionTypeParts)(type);
|
||||
const disallowFalseyLiteral = (operator === '||' && checkType === 'false') ||
|
||||
(operator === '&&' && checkType === 'true');
|
||||
if (disallowFalseyLiteral) {
|
||||
/*
|
||||
```
|
||||
declare const x: false | {a: string};
|
||||
x && x.a;
|
||||
!x || x.a;
|
||||
```
|
||||
|
||||
We don't want to consider these two cases because the boolean expression
|
||||
narrows out the non-nullish falsy cases - so converting the chain to `x?.a`
|
||||
would introduce a build error
|
||||
*/
|
||||
if (types.some(t => (0, ts_api_utils_1.isBooleanLiteralType)(t) && t.intrinsicName === 'false') ||
|
||||
types.some(t => (0, ts_api_utils_1.isStringLiteralType)(t) && t.value === '') ||
|
||||
types.some(t => (0, ts_api_utils_1.isNumberLiteralType)(t) && t.value === 0) ||
|
||||
types.some(t => (0, ts_api_utils_1.isBigIntLiteralType)(t) && t.value.base10Value === '0')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (options.requireNullish === true) {
|
||||
return types.some(t => (0, util_1.isTypeFlagSet)(t, NULLISH_FLAGS));
|
||||
}
|
||||
let allowedFlags = NULLISH_FLAGS | ts.TypeFlags.Object;
|
||||
if (options.checkAny === true) {
|
||||
allowedFlags |= ts.TypeFlags.Any;
|
||||
}
|
||||
if (options.checkUnknown === true) {
|
||||
allowedFlags |= ts.TypeFlags.Unknown;
|
||||
}
|
||||
if (options.checkString === true) {
|
||||
allowedFlags |= ts.TypeFlags.StringLike;
|
||||
}
|
||||
if (options.checkNumber === true) {
|
||||
allowedFlags |= ts.TypeFlags.NumberLike;
|
||||
}
|
||||
if (options.checkBoolean === true) {
|
||||
allowedFlags |= ts.TypeFlags.BooleanLike;
|
||||
}
|
||||
if (options.checkBigInt === true) {
|
||||
allowedFlags |= ts.TypeFlags.BigIntLike;
|
||||
}
|
||||
return types.every(t => (0, util_1.isTypeFlagSet)(t, allowedFlags));
|
||||
}
|
||||
function gatherLogicalOperands(node, parserServices, options) {
|
||||
const result = [];
|
||||
const { operands, newlySeenLogicals } = flattenLogicalOperands(node);
|
||||
for (const operand of operands) {
|
||||
switch (operand.type) {
|
||||
case utils_1.AST_NODE_TYPES.BinaryExpression: {
|
||||
// check for "yoda" style logical: null != x
|
||||
const { comparedExpression, comparedValue, isYoda } = (() => {
|
||||
// non-yoda checks are by far the most common, so check for them first
|
||||
const comparedValueRight = getComparisonValueType(operand.right);
|
||||
if (comparedValueRight) {
|
||||
return {
|
||||
comparedExpression: operand.left,
|
||||
comparedValue: comparedValueRight,
|
||||
isYoda: false,
|
||||
};
|
||||
}
|
||||
return {
|
||||
comparedExpression: operand.right,
|
||||
comparedValue: getComparisonValueType(operand.left),
|
||||
isYoda: true,
|
||||
};
|
||||
})();
|
||||
if (comparedValue === "UndefinedStringLiteral" /* ComparisonValueType.UndefinedStringLiteral */) {
|
||||
if (comparedExpression.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
|
||||
comparedExpression.operator === 'typeof') {
|
||||
// typeof x === 'undefined'
|
||||
result.push({
|
||||
type: "Valid" /* OperandValidity.Valid */,
|
||||
comparedName: comparedExpression.argument,
|
||||
comparisonType: operand.operator.startsWith('!')
|
||||
? "NotStrictEqualUndefined" /* NullishComparisonType.NotStrictEqualUndefined */
|
||||
: "StrictEqualUndefined" /* NullishComparisonType.StrictEqualUndefined */,
|
||||
isYoda,
|
||||
node: operand,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
// y === 'undefined'
|
||||
result.push({ type: "Invalid" /* OperandValidity.Invalid */ });
|
||||
continue;
|
||||
}
|
||||
switch (operand.operator) {
|
||||
case '!=':
|
||||
case '==':
|
||||
if (comparedValue === "Null" /* ComparisonValueType.Null */ ||
|
||||
comparedValue === "Undefined" /* ComparisonValueType.Undefined */) {
|
||||
// x == null, x == undefined
|
||||
result.push({
|
||||
type: "Valid" /* OperandValidity.Valid */,
|
||||
comparedName: comparedExpression,
|
||||
comparisonType: operand.operator.startsWith('!')
|
||||
? "NotEqualNullOrUndefined" /* NullishComparisonType.NotEqualNullOrUndefined */
|
||||
: "EqualNullOrUndefined" /* NullishComparisonType.EqualNullOrUndefined */,
|
||||
isYoda,
|
||||
node: operand,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
// x == something :(
|
||||
result.push({ type: "Invalid" /* OperandValidity.Invalid */ });
|
||||
continue;
|
||||
case '!==':
|
||||
case '===': {
|
||||
const comparedName = comparedExpression;
|
||||
switch (comparedValue) {
|
||||
case "Null" /* ComparisonValueType.Null */:
|
||||
result.push({
|
||||
type: "Valid" /* OperandValidity.Valid */,
|
||||
comparedName,
|
||||
comparisonType: operand.operator.startsWith('!')
|
||||
? "NotStrictEqualNull" /* NullishComparisonType.NotStrictEqualNull */
|
||||
: "StrictEqualNull" /* NullishComparisonType.StrictEqualNull */,
|
||||
isYoda,
|
||||
node: operand,
|
||||
});
|
||||
continue;
|
||||
case "Undefined" /* ComparisonValueType.Undefined */:
|
||||
result.push({
|
||||
type: "Valid" /* OperandValidity.Valid */,
|
||||
comparedName,
|
||||
comparisonType: operand.operator.startsWith('!')
|
||||
? "NotStrictEqualUndefined" /* NullishComparisonType.NotStrictEqualUndefined */
|
||||
: "StrictEqualUndefined" /* NullishComparisonType.StrictEqualUndefined */,
|
||||
isYoda,
|
||||
node: operand,
|
||||
});
|
||||
continue;
|
||||
default:
|
||||
// x === something :(
|
||||
result.push({ type: "Invalid" /* OperandValidity.Invalid */ });
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
result.push({ type: "Invalid" /* OperandValidity.Invalid */ });
|
||||
continue;
|
||||
}
|
||||
case utils_1.AST_NODE_TYPES.UnaryExpression:
|
||||
if (operand.operator === '!' &&
|
||||
isValidFalseBooleanCheckType(operand.argument, node.operator, 'false', parserServices, options)) {
|
||||
result.push({
|
||||
type: "Valid" /* OperandValidity.Valid */,
|
||||
comparedName: operand.argument,
|
||||
comparisonType: "NotBoolean" /* NullishComparisonType.NotBoolean */,
|
||||
isYoda: false,
|
||||
node: operand,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
result.push({ type: "Invalid" /* OperandValidity.Invalid */ });
|
||||
continue;
|
||||
case utils_1.AST_NODE_TYPES.LogicalExpression:
|
||||
// explicitly ignore the mixed logical expression cases
|
||||
result.push({ type: "Invalid" /* OperandValidity.Invalid */ });
|
||||
continue;
|
||||
default:
|
||||
if (isValidFalseBooleanCheckType(operand, node.operator, 'true', parserServices, options)) {
|
||||
result.push({
|
||||
type: "Valid" /* OperandValidity.Valid */,
|
||||
comparedName: operand,
|
||||
comparisonType: "Boolean" /* NullishComparisonType.Boolean */,
|
||||
isYoda: false,
|
||||
node: operand,
|
||||
});
|
||||
}
|
||||
else {
|
||||
result.push({ type: "Invalid" /* OperandValidity.Invalid */ });
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return {
|
||||
operands: result,
|
||||
newlySeenLogicals,
|
||||
};
|
||||
/*
|
||||
The AST is always constructed such the first element is always the deepest element.
|
||||
I.e. for this code: `foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz`
|
||||
The AST will look like this:
|
||||
{
|
||||
left: {
|
||||
left: {
|
||||
left: foo
|
||||
right: foo.bar
|
||||
}
|
||||
right: foo.bar.baz
|
||||
}
|
||||
right: foo.bar.baz.buzz
|
||||
}
|
||||
|
||||
So given any logical expression, we can perform a depth-first traversal to get
|
||||
the operands in order.
|
||||
|
||||
Note that this function purposely does not inspect mixed logical expressions
|
||||
like `foo || foo.bar && foo.bar.baz` - separate selector
|
||||
*/
|
||||
function flattenLogicalOperands(node) {
|
||||
const operands = [];
|
||||
const newlySeenLogicals = new Set([node]);
|
||||
const stack = [node.right, node.left];
|
||||
let current;
|
||||
while ((current = stack.pop())) {
|
||||
if (current.type === utils_1.AST_NODE_TYPES.LogicalExpression &&
|
||||
current.operator === node.operator) {
|
||||
newlySeenLogicals.add(current);
|
||||
stack.push(current.right);
|
||||
stack.push(current.left);
|
||||
}
|
||||
else {
|
||||
operands.push(current);
|
||||
}
|
||||
}
|
||||
return {
|
||||
operands,
|
||||
newlySeenLogicals,
|
||||
};
|
||||
}
|
||||
function getComparisonValueType(node) {
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.Literal:
|
||||
// eslint-disable-next-line eqeqeq -- intentional exact comparison against null
|
||||
if (node.value === null && node.raw === 'null') {
|
||||
return "Null" /* ComparisonValueType.Null */;
|
||||
}
|
||||
if (node.value === 'undefined') {
|
||||
return "UndefinedStringLiteral" /* ComparisonValueType.UndefinedStringLiteral */;
|
||||
}
|
||||
return null;
|
||||
case utils_1.AST_NODE_TYPES.Identifier:
|
||||
if (node.name === 'undefined') {
|
||||
return "Undefined" /* ComparisonValueType.Undefined */;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
exports.gatherLogicalOperands = gatherLogicalOperands;
|
||||
//# sourceMappingURL=gatherLogicalOperands.js.map
|
|
@ -0,0 +1 @@
|
|||
{"files":{"package.json":{"checkedAt":1707919834190,"integrity":"sha512-bBw8JasrR/kRMN6A3pJnVbeATr1V8eoc7FId3oWTGlm0qFjrSJTXm6qWeMJlTuzcTUkeg/S6q2yZVEXkeIdUDw==","mode":420,"size":672},"index.d.ts":{"checkedAt":1707919834190,"integrity":"sha512-VNzZJPn0ISprW5r9jLfNy8FNyGEZjzbT0IyIdzbpq+WOKNAmnhb0xddedaFwyp1+rdP9WLvTxZ1v6Bz11dgfmQ==","mode":420,"size":1823},"index.js":{"checkedAt":1707919834190,"integrity":"sha512-UswmejqRpM0lS8YBDetFz3BGA3EnIitZJZ5EXWs59mPtAcrKoT6B8tL+Dac7/GMd3bXBPdDu/Tlm1pgBoFvpDw==","mode":420,"size":1856},"license":{"checkedAt":1707919834190,"integrity":"sha512-nIst73auX/5NY2Fmv5Y116vWnNrEv4GaIUX3lpZG05rpXJY2S8EX+fpUS5hRjClCM0VdT2Za9DDHXXB5jdSrEw==","mode":420,"size":1109},"readme.md":{"checkedAt":1707919834190,"integrity":"sha512-OqZHSrDSTQZk9YX1+BJfXPM5X5VdE54qXdvtsgZ/FZ/4gNR9Q/rXDFMdc4EEgLTdlF3U1jr/lPIwv0J5F0oHbw==","mode":420,"size":2009}}}
|
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
|
||||
// npx nx generate-lib @typescript-eslint/scope-manager
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.esnext_array = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
exports.esnext_array = {
|
||||
Array: base_config_1.TYPE,
|
||||
ReadonlyArray: base_config_1.TYPE,
|
||||
Int8Array: base_config_1.TYPE,
|
||||
Uint8Array: base_config_1.TYPE,
|
||||
Uint8ClampedArray: base_config_1.TYPE,
|
||||
Int16Array: base_config_1.TYPE,
|
||||
Uint16Array: base_config_1.TYPE,
|
||||
Int32Array: base_config_1.TYPE,
|
||||
Uint32Array: base_config_1.TYPE,
|
||||
Float32Array: base_config_1.TYPE,
|
||||
Float64Array: base_config_1.TYPE,
|
||||
BigInt64Array: base_config_1.TYPE,
|
||||
BigUint64Array: base_config_1.TYPE,
|
||||
};
|
||||
//# sourceMappingURL=esnext.array.js.map
|
|
@ -0,0 +1,174 @@
|
|||
/**
|
||||
* @fileoverview Rule to flag statements that use != and == instead of !== and ===
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "Require the use of `===` and `!==`",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/eqeqeq"
|
||||
},
|
||||
|
||||
schema: {
|
||||
anyOf: [
|
||||
{
|
||||
type: "array",
|
||||
items: [
|
||||
{
|
||||
enum: ["always"]
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
null: {
|
||||
enum: ["always", "never", "ignore"]
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
],
|
||||
additionalItems: false
|
||||
},
|
||||
{
|
||||
type: "array",
|
||||
items: [
|
||||
{
|
||||
enum: ["smart", "allow-null"]
|
||||
}
|
||||
],
|
||||
additionalItems: false
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
fixable: "code",
|
||||
|
||||
messages: {
|
||||
unexpected: "Expected '{{expectedOperator}}' and instead saw '{{actualOperator}}'."
|
||||
}
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const config = context.options[0] || "always";
|
||||
const options = context.options[1] || {};
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
const nullOption = (config === "always")
|
||||
? options.null || "always"
|
||||
: "ignore";
|
||||
const enforceRuleForNull = (nullOption === "always");
|
||||
const enforceInverseRuleForNull = (nullOption === "never");
|
||||
|
||||
/**
|
||||
* Checks if an expression is a typeof expression
|
||||
* @param {ASTNode} node The node to check
|
||||
* @returns {boolean} if the node is a typeof expression
|
||||
*/
|
||||
function isTypeOf(node) {
|
||||
return node.type === "UnaryExpression" && node.operator === "typeof";
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if either operand of a binary expression is a typeof operation
|
||||
* @param {ASTNode} node The node to check
|
||||
* @returns {boolean} if one of the operands is typeof
|
||||
* @private
|
||||
*/
|
||||
function isTypeOfBinary(node) {
|
||||
return isTypeOf(node.left) || isTypeOf(node.right);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if operands are literals of the same type (via typeof)
|
||||
* @param {ASTNode} node The node to check
|
||||
* @returns {boolean} if operands are of same type
|
||||
* @private
|
||||
*/
|
||||
function areLiteralsAndSameType(node) {
|
||||
return node.left.type === "Literal" && node.right.type === "Literal" &&
|
||||
typeof node.left.value === typeof node.right.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if one of the operands is a literal null
|
||||
* @param {ASTNode} node The node to check
|
||||
* @returns {boolean} if operands are null
|
||||
* @private
|
||||
*/
|
||||
function isNullCheck(node) {
|
||||
return astUtils.isNullLiteral(node.right) || astUtils.isNullLiteral(node.left);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports a message for this rule.
|
||||
* @param {ASTNode} node The binary expression node that was checked
|
||||
* @param {string} expectedOperator The operator that was expected (either '==', '!=', '===', or '!==')
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function report(node, expectedOperator) {
|
||||
const operatorToken = sourceCode.getFirstTokenBetween(
|
||||
node.left,
|
||||
node.right,
|
||||
token => token.value === node.operator
|
||||
);
|
||||
|
||||
context.report({
|
||||
node,
|
||||
loc: operatorToken.loc,
|
||||
messageId: "unexpected",
|
||||
data: { expectedOperator, actualOperator: node.operator },
|
||||
fix(fixer) {
|
||||
|
||||
// If the comparison is a `typeof` comparison or both sides are literals with the same type, then it's safe to fix.
|
||||
if (isTypeOfBinary(node) || areLiteralsAndSameType(node)) {
|
||||
return fixer.replaceText(operatorToken, expectedOperator);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
BinaryExpression(node) {
|
||||
const isNull = isNullCheck(node);
|
||||
|
||||
if (node.operator !== "==" && node.operator !== "!=") {
|
||||
if (enforceInverseRuleForNull && isNull) {
|
||||
report(node, node.operator.slice(0, -1));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (config === "smart" && (isTypeOfBinary(node) ||
|
||||
areLiteralsAndSameType(node) || isNull)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enforceRuleForNull && isNull) {
|
||||
return;
|
||||
}
|
||||
|
||||
report(node, `${node.operator}=`);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"es2017.intl.d.ts","sourceRoot":"","sources":["../../src/lib/es2017.intl.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAG9D,eAAO,MAAM,WAAW,4CAEuB,CAAC"}
|
|
@ -0,0 +1 @@
|
|||
{"files":{"LICENSE":{"checkedAt":1707919832578,"integrity":"sha512-HQaIQk9pwOcyKutyDk4o2a87WnotwYuLGYFW43emGm4FvIJFKPyg+OYaw5sTegKAKf+C5SKa1ACjzCLivbaHrQ==","mode":420,"size":1141},"README.md":{"checkedAt":1707919832578,"integrity":"sha512-NPnOOTNH8GnomplTc8mmzebIzi0ZsnLiFfWnQK+pu/u+lm0ESQ4bi8Se2VUQZFRNbw7fIsYpdpBeaspnsThsTQ==","mode":420,"size":708},"index.d.ts":{"checkedAt":1707919832578,"integrity":"sha512-KueyhSCc/Pyn2LP3CbA6wgOemCXxDSow5oZljXFmhtOySx+s0C/QbOMFZ3YMx2707NVYcPezYws7Uhbtjvu6Og==","mode":420,"size":8251},"package.json":{"checkedAt":1707919832579,"integrity":"sha512-FbZoEUgo3qQums29fZLz4bHyZ2fqL8OsnCsiFvqMGBrZtmOxMXkl+AJFioGcTBv49o/xoMZf8vnCtZfBeoV3rA==","mode":420,"size":1294}}}
|
|
@ -0,0 +1,6 @@
|
|||
import _typeof from "./typeof.js";
|
||||
import toPrimitive from "./toPrimitive.js";
|
||||
export default function toPropertyKey(t) {
|
||||
var i = toPrimitive(t, "string");
|
||||
return "symbol" == _typeof(i) ? i : String(i);
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
function stringifyNode(node, custom) {
|
||||
var type = node.type
|
||||
var value = node.value
|
||||
var buf
|
||||
var customResult
|
||||
|
||||
if (custom && (customResult = custom(node)) !== undefined) {
|
||||
return customResult
|
||||
} else if (type === 'word' || type === 'space') {
|
||||
return value
|
||||
} else if (type === 'string') {
|
||||
buf = node.quote || ''
|
||||
return buf + value + (node.unclosed ? '' : buf)
|
||||
} else if (type === 'comment') {
|
||||
return '/*' + value + (node.unclosed ? '' : '*/')
|
||||
} else if (type === 'div') {
|
||||
return (node.before || '') + value + (node.after || '')
|
||||
} else if (Array.isArray(node.nodes)) {
|
||||
buf = stringify(node.nodes, custom)
|
||||
if (type !== 'function') {
|
||||
return buf
|
||||
}
|
||||
return value + '(' + (node.before || '') + buf + (node.after || '') + (node.unclosed ? '' : ')')
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
function stringify(nodes, custom) {
|
||||
var result, i
|
||||
|
||||
if (Array.isArray(nodes)) {
|
||||
result = ''
|
||||
for (i = nodes.length - 1; ~i; i -= 1) {
|
||||
result = stringifyNode(nodes[i], custom) + result
|
||||
}
|
||||
return result
|
||||
}
|
||||
return stringifyNode(nodes, custom)
|
||||
}
|
||||
|
||||
module.exports = stringify
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue