This commit is contained in:
2025-05-09 05:30:08 +02:00
parent 7bb10e7df4
commit 73367bad9e
5322 changed files with 1266973 additions and 313 deletions

View File

@@ -0,0 +1,22 @@
export type Config = import("eslint").Linter.Config;
export type LegacyConfig = import("eslint").Linter.LegacyConfig;
export type Plugin = import("eslint").ESLint.Plugin;
export type RuleEntry = import("eslint").Linter.RuleEntry;
export type ExtendsElement = import("./types.ts").ExtendsElement;
export type SimpleExtendsElement = import("./types.ts").SimpleExtendsElement;
export type ConfigWithExtends = import("./types.ts").ConfigWithExtends;
export type InfiniteConfigArray = import("./types.ts").InfiniteArray<Config>;
export type ConfigWithExtendsArray = import("./types.ts").ConfigWithExtendsArray;
/**
* Helper function to define a config array.
* @param {ConfigWithExtendsArray} args The arguments to the function.
* @returns {Config[]} The config array.
*/
export function defineConfig(...args: ConfigWithExtendsArray): Config[];
/**
* Creates a global ignores config with the given patterns.
* @param {string[]} ignorePatterns The ignore patterns.
* @param {string} [name] The name of the global ignores config.
* @returns {Config} The global ignores config.
*/
export function globalIgnores(ignorePatterns: string[], name?: string): Config;

View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = cleanJSXElementLiteralChild;
var _index = require("../../builders/generated/index.js");
var _index2 = require("../../index.js");
function cleanJSXElementLiteralChild(child, args) {
const lines = child.value.split(/\r\n|\n|\r/);
let lastNonEmptyLine = 0;
for (let i = 0; i < lines.length; i++) {
if (/[^ \t]/.exec(lines[i])) {
lastNonEmptyLine = i;
}
}
let str = "";
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
const isFirstLine = i === 0;
const isLastLine = i === lines.length - 1;
const isLastNonEmptyLine = i === lastNonEmptyLine;
let trimmedLine = line.replace(/\t/g, " ");
if (!isFirstLine) {
trimmedLine = trimmedLine.replace(/^ +/, "");
}
if (!isLastLine) {
trimmedLine = trimmedLine.replace(/ +$/, "");
}
if (trimmedLine) {
if (!isLastNonEmptyLine) {
trimmedLine += " ";
}
str += trimmedLine;
}
}
if (str) args.push((0, _index2.inherits)((0, _index.stringLiteral)(str), child));
}
//# sourceMappingURL=cleanJSXElementLiteralChild.js.map

View File

@@ -0,0 +1,17 @@
let { execSync } = require('child_process')
let pico = require('picocolors')
try {
let version = parseInt(execSync('npm -v'))
if (version <= 6) {
process.stderr.write(
pico.red(
'Update npm or call ' +
pico.yellow('npx browserslist@latest --update-db') +
'\n'
)
)
process.exit(1)
}
// eslint-disable-next-line no-unused-vars
} catch (e) {}

View File

@@ -0,0 +1,684 @@
/**
* @fileoverview A rule to control the use of single variable declarations.
* @author Ian Christian Myers
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Determines whether the given node is in a statement list.
* @param {ASTNode} node node to check
* @returns {boolean} `true` if the given node is in a statement list
*/
function isInStatementList(node) {
return astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type);
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"Enforce variables to be declared either together or separately in functions",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/one-var",
},
fixable: "code",
schema: [
{
oneOf: [
{
enum: ["always", "never", "consecutive"],
},
{
type: "object",
properties: {
separateRequires: {
type: "boolean",
},
var: {
enum: ["always", "never", "consecutive"],
},
let: {
enum: ["always", "never", "consecutive"],
},
const: {
enum: ["always", "never", "consecutive"],
},
},
additionalProperties: false,
},
{
type: "object",
properties: {
initialized: {
enum: ["always", "never", "consecutive"],
},
uninitialized: {
enum: ["always", "never", "consecutive"],
},
},
additionalProperties: false,
},
],
},
],
messages: {
combineUninitialized:
"Combine this with the previous '{{type}}' statement with uninitialized variables.",
combineInitialized:
"Combine this with the previous '{{type}}' statement with initialized variables.",
splitUninitialized:
"Split uninitialized '{{type}}' declarations into multiple statements.",
splitInitialized:
"Split initialized '{{type}}' declarations into multiple statements.",
splitRequires:
"Split requires to be separated into a single block.",
combine: "Combine this with the previous '{{type}}' statement.",
split: "Split '{{type}}' declarations into multiple statements.",
},
},
create(context) {
const MODE_ALWAYS = "always";
const MODE_NEVER = "never";
const MODE_CONSECUTIVE = "consecutive";
const mode = context.options[0] || MODE_ALWAYS;
const options = {};
if (typeof mode === "string") {
// simple options configuration with just a string
options.var = { uninitialized: mode, initialized: mode };
options.let = { uninitialized: mode, initialized: mode };
options.const = { uninitialized: mode, initialized: mode };
} else if (typeof mode === "object") {
// options configuration is an object
options.separateRequires = !!mode.separateRequires;
options.var = { uninitialized: mode.var, initialized: mode.var };
options.let = { uninitialized: mode.let, initialized: mode.let };
options.const = {
uninitialized: mode.const,
initialized: mode.const,
};
if (Object.hasOwn(mode, "uninitialized")) {
options.var.uninitialized = mode.uninitialized;
options.let.uninitialized = mode.uninitialized;
options.const.uninitialized = mode.uninitialized;
}
if (Object.hasOwn(mode, "initialized")) {
options.var.initialized = mode.initialized;
options.let.initialized = mode.initialized;
options.const.initialized = mode.initialized;
}
}
const sourceCode = context.sourceCode;
//--------------------------------------------------------------------------
// Helpers
//--------------------------------------------------------------------------
const functionStack = [];
const blockStack = [];
/**
* Increments the blockStack counter.
* @returns {void}
* @private
*/
function startBlock() {
blockStack.push({
let: { initialized: false, uninitialized: false },
const: { initialized: false, uninitialized: false },
});
}
/**
* Increments the functionStack counter.
* @returns {void}
* @private
*/
function startFunction() {
functionStack.push({ initialized: false, uninitialized: false });
startBlock();
}
/**
* Decrements the blockStack counter.
* @returns {void}
* @private
*/
function endBlock() {
blockStack.pop();
}
/**
* Decrements the functionStack counter.
* @returns {void}
* @private
*/
function endFunction() {
functionStack.pop();
endBlock();
}
/**
* Check if a variable declaration is a require.
* @param {ASTNode} decl variable declaration Node
* @returns {bool} if decl is a require, return true; else return false.
* @private
*/
function isRequire(decl) {
return (
decl.init &&
decl.init.type === "CallExpression" &&
decl.init.callee.name === "require"
);
}
/**
* Records whether initialized/uninitialized/required variables are defined in current scope.
* @param {string} statementType node.kind, one of: "var", "let", or "const"
* @param {ASTNode[]} declarations List of declarations
* @param {Object} currentScope The scope being investigated
* @returns {void}
* @private
*/
function recordTypes(statementType, declarations, currentScope) {
for (let i = 0; i < declarations.length; i++) {
if (declarations[i].init === null) {
if (
options[statementType] &&
options[statementType].uninitialized === MODE_ALWAYS
) {
currentScope.uninitialized = true;
}
} else {
if (
options[statementType] &&
options[statementType].initialized === MODE_ALWAYS
) {
if (
options.separateRequires &&
isRequire(declarations[i])
) {
currentScope.required = true;
} else {
currentScope.initialized = true;
}
}
}
}
}
/**
* Determines the current scope (function or block)
* @param {string} statementType node.kind, one of: "var", "let", or "const"
* @returns {Object} The scope associated with statementType
*/
function getCurrentScope(statementType) {
let currentScope;
if (statementType === "var") {
currentScope = functionStack.at(-1);
} else if (statementType === "let") {
currentScope = blockStack.at(-1).let;
} else if (statementType === "const") {
currentScope = blockStack.at(-1).const;
}
return currentScope;
}
/**
* Counts the number of initialized and uninitialized declarations in a list of declarations
* @param {ASTNode[]} declarations List of declarations
* @returns {Object} Counts of 'uninitialized' and 'initialized' declarations
* @private
*/
function countDeclarations(declarations) {
const counts = { uninitialized: 0, initialized: 0 };
for (let i = 0; i < declarations.length; i++) {
if (declarations[i].init === null) {
counts.uninitialized++;
} else {
counts.initialized++;
}
}
return counts;
}
/**
* Determines if there is more than one var statement in the current scope.
* @param {string} statementType node.kind, one of: "var", "let", or "const"
* @param {ASTNode[]} declarations List of declarations
* @returns {boolean} Returns true if it is the first var declaration, false if not.
* @private
*/
function hasOnlyOneStatement(statementType, declarations) {
const declarationCounts = countDeclarations(declarations);
const currentOptions = options[statementType] || {};
const currentScope = getCurrentScope(statementType);
const hasRequires = declarations.some(isRequire);
if (
currentOptions.uninitialized === MODE_ALWAYS &&
currentOptions.initialized === MODE_ALWAYS
) {
if (currentScope.uninitialized || currentScope.initialized) {
if (!hasRequires) {
return false;
}
}
}
if (declarationCounts.uninitialized > 0) {
if (
currentOptions.uninitialized === MODE_ALWAYS &&
currentScope.uninitialized
) {
return false;
}
}
if (declarationCounts.initialized > 0) {
if (
currentOptions.initialized === MODE_ALWAYS &&
currentScope.initialized
) {
if (!hasRequires) {
return false;
}
}
}
if (currentScope.required && hasRequires) {
return false;
}
recordTypes(statementType, declarations, currentScope);
return true;
}
/**
* Fixer to join VariableDeclaration's into a single declaration
* @param {VariableDeclarator[]} declarations The `VariableDeclaration` to join
* @returns {Function} The fixer function
*/
function joinDeclarations(declarations) {
const declaration = declarations[0];
const body = Array.isArray(declaration.parent.parent.body)
? declaration.parent.parent.body
: [];
const currentIndex = body.findIndex(
node => node.range[0] === declaration.parent.range[0],
);
const previousNode = body[currentIndex - 1];
return fixer => {
const type = sourceCode.getTokenBefore(declaration);
const prevSemi = sourceCode.getTokenBefore(type);
const res = [];
if (
previousNode &&
previousNode.kind === sourceCode.getText(type)
) {
if (prevSemi.value === ";") {
res.push(fixer.replaceText(prevSemi, ","));
} else {
res.push(fixer.insertTextAfter(prevSemi, ","));
}
res.push(fixer.replaceText(type, ""));
}
return res;
};
}
/**
* Fixer to split a VariableDeclaration into individual declarations
* @param {VariableDeclaration} declaration The `VariableDeclaration` to split
* @returns {Function|null} The fixer function
*/
function splitDeclarations(declaration) {
const { parent } = declaration;
// don't autofix code such as: if (foo) var x, y;
if (
!isInStatementList(
parent.type === "ExportNamedDeclaration"
? parent
: declaration,
)
) {
return null;
}
return fixer =>
declaration.declarations
.map(declarator => {
const tokenAfterDeclarator =
sourceCode.getTokenAfter(declarator);
if (tokenAfterDeclarator === null) {
return null;
}
const afterComma = sourceCode.getTokenAfter(
tokenAfterDeclarator,
{ includeComments: true },
);
if (tokenAfterDeclarator.value !== ",") {
return null;
}
const exportPlacement =
declaration.parent.type === "ExportNamedDeclaration"
? "export "
: "";
/*
* `var x,y`
* tokenAfterDeclarator ^^ afterComma
*/
if (
afterComma.range[0] ===
tokenAfterDeclarator.range[1]
) {
return fixer.replaceText(
tokenAfterDeclarator,
`; ${exportPlacement}${declaration.kind} `,
);
}
/*
* `var x,
* tokenAfterDeclarator ^
* y`
* ^ afterComma
*/
if (
afterComma.loc.start.line >
tokenAfterDeclarator.loc.end.line ||
afterComma.type === "Line" ||
afterComma.type === "Block"
) {
let lastComment = afterComma;
while (
lastComment.type === "Line" ||
lastComment.type === "Block"
) {
lastComment = sourceCode.getTokenAfter(
lastComment,
{ includeComments: true },
);
}
return fixer.replaceTextRange(
[
tokenAfterDeclarator.range[0],
lastComment.range[0],
],
`;${sourceCode.text.slice(tokenAfterDeclarator.range[1], lastComment.range[0])}${exportPlacement}${declaration.kind} `,
);
}
return fixer.replaceText(
tokenAfterDeclarator,
`; ${exportPlacement}${declaration.kind}`,
);
})
.filter(x => x);
}
/**
* Checks a given VariableDeclaration node for errors.
* @param {ASTNode} node The VariableDeclaration node to check
* @returns {void}
* @private
*/
function checkVariableDeclaration(node) {
const parent = node.parent;
const type = node.kind;
if (!options[type]) {
return;
}
const declarations = node.declarations;
const declarationCounts = countDeclarations(declarations);
const mixedRequires =
declarations.some(isRequire) && !declarations.every(isRequire);
if (options[type].initialized === MODE_ALWAYS) {
if (options.separateRequires && mixedRequires) {
context.report({
node,
messageId: "splitRequires",
});
}
}
// consecutive
const nodeIndex =
(parent.body &&
parent.body.length > 0 &&
parent.body.indexOf(node)) ||
0;
if (nodeIndex > 0) {
const previousNode = parent.body[nodeIndex - 1];
const isPreviousNodeDeclaration =
previousNode.type === "VariableDeclaration";
const declarationsWithPrevious = declarations.concat(
previousNode.declarations || [],
);
if (
isPreviousNodeDeclaration &&
previousNode.kind === type &&
!(
declarationsWithPrevious.some(isRequire) &&
!declarationsWithPrevious.every(isRequire)
)
) {
const previousDeclCounts = countDeclarations(
previousNode.declarations,
);
if (
options[type].initialized === MODE_CONSECUTIVE &&
options[type].uninitialized === MODE_CONSECUTIVE
) {
context.report({
node,
messageId: "combine",
data: {
type,
},
fix: joinDeclarations(declarations),
});
} else if (
options[type].initialized === MODE_CONSECUTIVE &&
declarationCounts.initialized > 0 &&
previousDeclCounts.initialized > 0
) {
context.report({
node,
messageId: "combineInitialized",
data: {
type,
},
fix: joinDeclarations(declarations),
});
} else if (
options[type].uninitialized === MODE_CONSECUTIVE &&
declarationCounts.uninitialized > 0 &&
previousDeclCounts.uninitialized > 0
) {
context.report({
node,
messageId: "combineUninitialized",
data: {
type,
},
fix: joinDeclarations(declarations),
});
}
}
}
// always
if (!hasOnlyOneStatement(type, declarations)) {
if (
options[type].initialized === MODE_ALWAYS &&
options[type].uninitialized === MODE_ALWAYS
) {
context.report({
node,
messageId: "combine",
data: {
type,
},
fix: joinDeclarations(declarations),
});
} else {
if (
options[type].initialized === MODE_ALWAYS &&
declarationCounts.initialized > 0
) {
context.report({
node,
messageId: "combineInitialized",
data: {
type,
},
fix: joinDeclarations(declarations),
});
}
if (
options[type].uninitialized === MODE_ALWAYS &&
declarationCounts.uninitialized > 0
) {
if (
node.parent.left === node &&
(node.parent.type === "ForInStatement" ||
node.parent.type === "ForOfStatement")
) {
return;
}
context.report({
node,
messageId: "combineUninitialized",
data: {
type,
},
fix: joinDeclarations(declarations),
});
}
}
}
// never
if (parent.type !== "ForStatement" || parent.init !== node) {
const totalDeclarations =
declarationCounts.uninitialized +
declarationCounts.initialized;
if (totalDeclarations > 1) {
if (
options[type].initialized === MODE_NEVER &&
options[type].uninitialized === MODE_NEVER
) {
// both initialized and uninitialized
context.report({
node,
messageId: "split",
data: {
type,
},
fix: splitDeclarations(node),
});
} else if (
options[type].initialized === MODE_NEVER &&
declarationCounts.initialized > 0
) {
// initialized
context.report({
node,
messageId: "splitInitialized",
data: {
type,
},
fix: splitDeclarations(node),
});
} else if (
options[type].uninitialized === MODE_NEVER &&
declarationCounts.uninitialized > 0
) {
// uninitialized
context.report({
node,
messageId: "splitUninitialized",
data: {
type,
},
fix: splitDeclarations(node),
});
}
}
}
}
//--------------------------------------------------------------------------
// Public API
//--------------------------------------------------------------------------
return {
Program: startFunction,
FunctionDeclaration: startFunction,
FunctionExpression: startFunction,
ArrowFunctionExpression: startFunction,
StaticBlock: startFunction, // StaticBlock creates a new scope for `var` variables
BlockStatement: startBlock,
ForStatement: startBlock,
ForInStatement: startBlock,
ForOfStatement: startBlock,
SwitchStatement: startBlock,
VariableDeclaration: checkVariableDeclaration,
"ForStatement:exit": endBlock,
"ForOfStatement:exit": endBlock,
"ForInStatement:exit": endBlock,
"SwitchStatement:exit": endBlock,
"BlockStatement:exit": endBlock,
"Program:exit": endFunction,
"FunctionDeclaration:exit": endFunction,
"FunctionExpression:exit": endFunction,
"ArrowFunctionExpression:exit": endFunction,
"StaticBlock:exit": endFunction,
};
},
};

View File

@@ -0,0 +1,7 @@
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.js');
} else {
module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');
}

View File

@@ -0,0 +1,27 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.warning = factory());
}(this, function () { 'use strict';
function warning(condition, message) {
{
if (condition) {
return;
}
var text = "Warning: " + message;
if (typeof console !== 'undefined') {
console.warn(text);
}
try {
throw Error(text);
} catch (x) {}
}
}
return warning;
}));

View File

@@ -0,0 +1,9 @@
'use client';
import { createContext } from 'react';
import type { OutlineContextType } from './shared/types.js';
const outlineContext: React.Context<OutlineContextType> = createContext<OutlineContextType>(null);
export default outlineContext;

View File

@@ -0,0 +1,3 @@
# `@tailwindcss/oxide-linux-arm64-musl`
This is the **aarch64-unknown-linux-musl** binary for `@tailwindcss/oxide`

View File

@@ -0,0 +1 @@
{"version":3,"names":["getAssignmentIdentifiers","node","search","concat","ids","Object","create","length","id","pop","type","push","elements","left","properties","value","argument","operator","name"],"sources":["../../src/retrievers/getAssignmentIdentifiers.ts"],"sourcesContent":["import type * as t from \"../index.ts\";\n\n/**\n * For the given node, generate a map from assignment id names to the identifier node.\n * Unlike getBindingIdentifiers, this function does not handle declarations and imports.\n * @param node the assignment expression or forXstatement\n * @returns an object map\n * @see getBindingIdentifiers\n */\nexport default function getAssignmentIdentifiers(\n node: t.Node | t.Node[],\n): Record<string, t.Identifier> {\n // null represents holes in an array pattern\n const search: (t.Node | null)[] = [].concat(node);\n const ids = Object.create(null);\n\n while (search.length) {\n const id = search.pop();\n if (!id) continue;\n\n switch (id.type) {\n case \"ArrayPattern\":\n search.push(...id.elements);\n break;\n\n case \"AssignmentExpression\":\n case \"AssignmentPattern\":\n case \"ForInStatement\":\n case \"ForOfStatement\":\n search.push(id.left);\n break;\n\n case \"ObjectPattern\":\n search.push(...id.properties);\n break;\n\n case \"ObjectProperty\":\n search.push(id.value);\n break;\n\n case \"RestElement\":\n case \"UpdateExpression\":\n search.push(id.argument);\n break;\n\n case \"UnaryExpression\":\n if (id.operator === \"delete\") {\n search.push(id.argument);\n }\n break;\n\n case \"Identifier\":\n ids[id.name] = id;\n break;\n\n default:\n break;\n }\n }\n\n return ids;\n}\n"],"mappings":";;;;;;AASe,SAASA,wBAAwBA,CAC9CC,IAAuB,EACO;EAE9B,MAAMC,MAAyB,GAAG,EAAE,CAACC,MAAM,CAACF,IAAI,CAAC;EACjD,MAAMG,GAAG,GAAGC,MAAM,CAACC,MAAM,CAAC,IAAI,CAAC;EAE/B,OAAOJ,MAAM,CAACK,MAAM,EAAE;IACpB,MAAMC,EAAE,GAAGN,MAAM,CAACO,GAAG,CAAC,CAAC;IACvB,IAAI,CAACD,EAAE,EAAE;IAET,QAAQA,EAAE,CAACE,IAAI;MACb,KAAK,cAAc;QACjBR,MAAM,CAACS,IAAI,CAAC,GAAGH,EAAE,CAACI,QAAQ,CAAC;QAC3B;MAEF,KAAK,sBAAsB;MAC3B,KAAK,mBAAmB;MACxB,KAAK,gBAAgB;MACrB,KAAK,gBAAgB;QACnBV,MAAM,CAACS,IAAI,CAACH,EAAE,CAACK,IAAI,CAAC;QACpB;MAEF,KAAK,eAAe;QAClBX,MAAM,CAACS,IAAI,CAAC,GAAGH,EAAE,CAACM,UAAU,CAAC;QAC7B;MAEF,KAAK,gBAAgB;QACnBZ,MAAM,CAACS,IAAI,CAACH,EAAE,CAACO,KAAK,CAAC;QACrB;MAEF,KAAK,aAAa;MAClB,KAAK,kBAAkB;QACrBb,MAAM,CAACS,IAAI,CAACH,EAAE,CAACQ,QAAQ,CAAC;QACxB;MAEF,KAAK,iBAAiB;QACpB,IAAIR,EAAE,CAACS,QAAQ,KAAK,QAAQ,EAAE;UAC5Bf,MAAM,CAACS,IAAI,CAACH,EAAE,CAACQ,QAAQ,CAAC;QAC1B;QACA;MAEF,KAAK,YAAY;QACfZ,GAAG,CAACI,EAAE,CAACU,IAAI,CAAC,GAAGV,EAAE;QACjB;MAEF;QACE;IACJ;EACF;EAEA,OAAOJ,GAAG;AACZ","ignoreList":[]}

View File

@@ -0,0 +1,186 @@
### Made by [@kilianvalkhof](https://twitter.com/kilianvalkhof)
#### Other projects:
- 💻 [Polypane](https://polypane.app) - Develop responsive websites and apps twice as fast on multiple screens at once
- 🖌️ [Superposition](https://superposition.design) - Kickstart your design system by extracting design tokens from your website
- 🗒️ [FromScratch](https://fromscratch.rocks) - A smart but simple autosaving scratchpad
---
# Electron-to-Chromium [![npm](https://img.shields.io/npm/v/electron-to-chromium.svg)](https://www.npmjs.com/package/electron-to-chromium) [![travis](https://img.shields.io/travis/Kilian/electron-to-chromium/master.svg)](https://travis-ci.org/Kilian/electron-to-chromium) [![npm-downloads](https://img.shields.io/npm/dm/electron-to-chromium.svg)](https://www.npmjs.com/package/electron-to-chromium) [![codecov](https://codecov.io/gh/Kilian/electron-to-chromium/branch/master/graph/badge.svg)](https://codecov.io/gh/Kilian/electron-to-chromium)[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FKilian%2Felectron-to-chromium.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FKilian%2Felectron-to-chromium?ref=badge_shield)
This repository provides a mapping of Electron versions to the Chromium version that it uses.
This package is used in [Browserslist](https://github.com/ai/browserslist), so you can use e.g. `electron >= 1.4` in [Autoprefixer](https://github.com/postcss/autoprefixer), [Stylelint](https://github.com/stylelint/stylelint), [babel-preset-env](https://github.com/babel/babel-preset-env) and [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat).
**Supported by:**
<a href="https://m.do.co/c/bb22ea58e765">
<img src="https://opensource.nyc3.cdn.digitaloceanspaces.com/attribution/assets/SVG/DO_Logo_horizontal_blue.svg" width="201px">
</a>
## Install
Install using `npm install electron-to-chromium`.
## Usage
To include Electron-to-Chromium, require it:
```js
var e2c = require('electron-to-chromium');
```
### Properties
The Electron-to-Chromium object has 4 properties to use:
#### `versions`
An object of key-value pairs with a _major_ Electron version as the key, and the corresponding major Chromium version as the value.
```js
var versions = e2c.versions;
console.log(versions['1.4']);
// returns "53"
```
#### `fullVersions`
An object of key-value pairs with a Electron version as the key, and the corresponding full Chromium version as the value.
```js
var versions = e2c.fullVersions;
console.log(versions['1.4.11']);
// returns "53.0.2785.143"
```
#### `chromiumVersions`
An object of key-value pairs with a _major_ Chromium version as the key, and the corresponding major Electron version as the value.
```js
var versions = e2c.chromiumVersions;
console.log(versions['54']);
// returns "1.4"
```
#### `fullChromiumVersions`
An object of key-value pairs with a Chromium version as the key, and an array of the corresponding major Electron versions as the value.
```js
var versions = e2c.fullChromiumVersions;
console.log(versions['54.0.2840.101']);
// returns ["1.5.1", "1.5.0"]
```
### Functions
#### `electronToChromium(query)`
Arguments:
* Query: string or number, required. A major or full Electron version.
A function that returns the corresponding Chromium version for a given Electron function. Returns a string.
If you provide it with a major Electron version, it will return a major Chromium version:
```js
var chromeVersion = e2c.electronToChromium('1.4');
// chromeVersion is "53"
```
If you provide it with a full Electron version, it will return the full Chromium version.
```js
var chromeVersion = e2c.electronToChromium('1.4.11');
// chromeVersion is "53.0.2785.143"
```
If a query does not match a Chromium version, it will return `undefined`.
```js
var chromeVersion = e2c.electronToChromium('9000');
// chromeVersion is undefined
```
#### `chromiumToElectron(query)`
Arguments:
* Query: string or number, required. A major or full Chromium version.
Returns a string with the corresponding Electron version for a given Chromium query.
If you provide it with a major Chromium version, it will return a major Electron version:
```js
var electronVersion = e2c.chromiumToElectron('54');
// electronVersion is "1.4"
```
If you provide it with a full Chrome version, it will return an array of full Electron versions.
```js
var electronVersions = e2c.chromiumToElectron('56.0.2924.87');
// electronVersions is ["1.6.3", "1.6.2", "1.6.1", "1.6.0"]
```
If a query does not match an Electron version, it will return `undefined`.
```js
var electronVersion = e2c.chromiumToElectron('10');
// electronVersion is undefined
```
#### `electronToBrowserList(query)` **DEPRECATED**
Arguments:
* Query: string or number, required. A major Electron version.
_**Deprecated**: Browserlist already includes electron-to-chromium._
A function that returns a [Browserslist](https://github.com/ai/browserslist) query that matches the given major Electron version. Returns a string.
If you provide it with a major Electron version, it will return a Browserlist query string that matches the Chromium capabilities:
```js
var query = e2c.electronToBrowserList('1.4');
// query is "Chrome >= 53"
```
If a query does not match a Chromium version, it will return `undefined`.
```js
var query = e2c.electronToBrowserList('9000');
// query is undefined
```
### Importing just versions, fullVersions, chromiumVersions and fullChromiumVersions
All lists can be imported on their own, if file size is a concern.
#### `versions`
```js
var versions = require('electron-to-chromium/versions');
```
#### `fullVersions`
```js
var fullVersions = require('electron-to-chromium/full-versions');
```
#### `chromiumVersions`
```js
var chromiumVersions = require('electron-to-chromium/chromium-versions');
```
#### `fullChromiumVersions`
```js
var fullChromiumVersions = require('electron-to-chromium/full-chromium-versions');
```
## Updating
This package will be updated with each new Electron release.
To update the list, run `npm run build.js`. Requires internet access as it downloads from the canonical list of Electron versions.
To verify correct behaviour, run `npm test`.
## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FKilian%2Felectron-to-chromium.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FKilian%2Felectron-to-chromium?ref=badge_large)

View File

@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _createRawReactElement;
var REACT_ELEMENT_TYPE;
function _createRawReactElement(type, props, key, children) {
if (!REACT_ELEMENT_TYPE) {
REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7;
}
var defaultProps = type && type.defaultProps;
var childrenLength = arguments.length - 3;
if (!props && childrenLength !== 0) {
props = {
children: void 0
};
}
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = new Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 3];
}
props.children = childArray;
}
if (props && defaultProps) {
for (var propName in defaultProps) {
if (props[propName] === void 0) {
props[propName] = defaultProps[propName];
}
}
} else if (!props) {
props = defaultProps || {};
}
return {
$$typeof: REACT_ELEMENT_TYPE,
type: type,
key: key === undefined ? null : "" + key,
ref: null,
props: props,
_owner: null
};
}
//# sourceMappingURL=jsx.js.map

View File

@@ -0,0 +1,26 @@
import React from 'react';
import useSyncExternalStoreExports from 'use-sync-external-store/shim/with-selector.js';
import { createStore } from 'zustand/vanilla';
const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;
const identity = (arg) => arg;
function useStoreWithEqualityFn(api, selector = identity, equalityFn) {
const slice = useSyncExternalStoreWithSelector(
api.subscribe,
api.getState,
api.getInitialState,
selector,
equalityFn
);
React.useDebugValue(slice);
return slice;
}
const createWithEqualityFnImpl = (createState, defaultEqualityFn) => {
const api = createStore(createState);
const useBoundStoreWithEqualityFn = (selector, equalityFn = defaultEqualityFn) => useStoreWithEqualityFn(api, selector, equalityFn);
Object.assign(useBoundStoreWithEqualityFn, api);
return useBoundStoreWithEqualityFn;
};
const createWithEqualityFn = (createState, defaultEqualityFn) => createState ? createWithEqualityFnImpl(createState, defaultEqualityFn) : createWithEqualityFnImpl;
export { createWithEqualityFn, useStoreWithEqualityFn };

View File

@@ -0,0 +1,29 @@
/*
@license
Rollup.js v4.39.0
Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
https://github.com/rollup/rollup
Released under the MIT License.
*/
'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
require('node:fs/promises');
require('node:path');
require('node:process');
require('node:url');
require('./shared/rollup.js');
require('./shared/parseAst.js');
const loadConfigFile_js = require('./shared/loadConfigFile.js');
require('path');
require('./native.js');
require('node:perf_hooks');
require('./getLogFilter.js');
exports.loadConfigFile = loadConfigFile_js.loadConfigFile;
//# sourceMappingURL=loadConfigFile.js.map