@eslint-react/shared
Advanced tools
Comparing version 1.23.2 to 1.23.3-beta.2
'use strict'; | ||
var utils = require('@typescript-eslint/utils'); | ||
var module$1 = require('module'); | ||
var eff = require('@eslint-react/eff'); | ||
var tsPattern = require('ts-pattern'); | ||
var module$1 = require('module'); | ||
var pm = require('picomatch'); | ||
@@ -15,5 +15,2 @@ | ||
// src/cache.ts | ||
var normalizedSettingsCache = /* @__PURE__ */ new WeakMap(); | ||
// src/constants.ts | ||
@@ -222,25 +219,18 @@ var NPM_SCOPE = "@eslint-react"; | ||
var getDocsUrl = (pluginName) => (ruleName) => { | ||
if (pluginName === "x") return `${WEBSITE_URL}/docs/rules/${ruleName}`; | ||
if (pluginName === "x") { | ||
return `${WEBSITE_URL}/docs/rules/${ruleName}`; | ||
} | ||
return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`; | ||
}; | ||
var createRuleForPlugin = (pluginName) => utils.ESLintUtils.RuleCreator(getDocsUrl(pluginName)); | ||
function tryRequire(id, at = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))) { | ||
const _require = module__default.default.createRequire(at); | ||
var _require = module__default.default.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))); | ||
function getReactVersion(fallback = "19.0.0") { | ||
try { | ||
return eff.E.right(_require(id)); | ||
return tsPattern.match(_require("react")).with({ version: tsPattern.P.select(tsPattern.P.string) }, eff.F.identity).otherwise(eff.F.constant(fallback)); | ||
} catch { | ||
return eff.E.left(new Error(`Module '${id}' not found`)); | ||
return fallback; | ||
} | ||
} | ||
// src/get-react-version.ts | ||
function getReactVersion(at = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))) { | ||
return eff.F.pipe( | ||
tryRequire("react", at), | ||
eff.E.filterOrLeft(tsPattern.isMatching({ version: tsPattern.P.string }), eff.F.identity), | ||
eff.E.map((mod) => mod.version) | ||
); | ||
} | ||
// ../../node_modules/.pnpm/valibot@1.0.0-beta.10_typescript@5.7.2/node_modules/valibot/dist/index.js | ||
// ../../node_modules/.pnpm/valibot@1.0.0-beta.11_typescript@5.7.2/node_modules/valibot/dist/index.js | ||
var store; | ||
@@ -256,3 +246,67 @@ // @__NO_SIDE_EFFECTS__ | ||
} | ||
var store2; | ||
// @__NO_SIDE_EFFECTS__ | ||
function getGlobalMessage(lang) { | ||
return store2?.get(lang); | ||
} | ||
var store3; | ||
// @__NO_SIDE_EFFECTS__ | ||
function getSchemaMessage(lang) { | ||
return store3?.get(lang); | ||
} | ||
var store4; | ||
// @__NO_SIDE_EFFECTS__ | ||
function getSpecificMessage(reference, lang) { | ||
return store4?.get(reference)?.get(lang); | ||
} | ||
// @__NO_SIDE_EFFECTS__ | ||
function _stringify(input) { | ||
const type = typeof input; | ||
if (type === "string") { | ||
return `"${input}"`; | ||
} | ||
if (type === "number" || type === "bigint" || type === "boolean") { | ||
return `${input}`; | ||
} | ||
if (type === "object" || type === "function") { | ||
return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null"; | ||
} | ||
return type; | ||
} | ||
function _addIssue(context, label, dataset, config2, other) { | ||
const input = dataset.value; | ||
const expected = context.expects ?? null; | ||
const received = /* @__PURE__ */ _stringify(input); | ||
const issue = { | ||
kind: context.kind, | ||
type: context.type, | ||
input, | ||
expected, | ||
received, | ||
message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`, | ||
requirement: context.requirement, | ||
path: other?.path, | ||
issues: other?.issues, | ||
lang: config2.lang, | ||
abortEarly: config2.abortEarly, | ||
abortPipeEarly: config2.abortPipeEarly | ||
}; | ||
const isSchema = context.kind === "schema"; | ||
const message = context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang); | ||
if (message) { | ||
issue.message = typeof message === "function" ? ( | ||
// @ts-expect-error | ||
message(issue) | ||
) : message; | ||
} | ||
if (isSchema) { | ||
dataset.typed = false; | ||
} | ||
if (dataset.issues) { | ||
dataset.issues.push(issue); | ||
} else { | ||
dataset.issues = [issue]; | ||
} | ||
} | ||
// @__NO_SIDE_EFFECTS__ | ||
function _getStandardProps(context) { | ||
@@ -339,2 +393,4 @@ return { | ||
} | ||
} else { | ||
_addIssue(this, "type", dataset, config2); | ||
} | ||
@@ -360,2 +416,4 @@ return dataset; | ||
dataset.typed = true; | ||
} else { | ||
_addIssue(this, "type", dataset, config2); | ||
} | ||
@@ -382,2 +440,4 @@ return dataset; | ||
dataset.typed = true; | ||
} else { | ||
_addIssue(this, "type", dataset, config2); | ||
} | ||
@@ -440,2 +500,4 @@ return dataset; | ||
} | ||
} else { | ||
_addIssue(this, "type", dataset, config2); | ||
} | ||
@@ -488,2 +550,4 @@ return dataset; | ||
dataset.typed = true; | ||
} else { | ||
_addIssue(this, "type", dataset, config2); | ||
} | ||
@@ -650,3 +714,3 @@ return dataset; | ||
// ../../node_modules/.pnpm/fast-equals@5.2.0/node_modules/fast-equals/dist/esm/index.mjs | ||
// ../../node_modules/.pnpm/fast-equals@5.2.1/node_modules/fast-equals/dist/esm/index.mjs | ||
var getOwnPropertyNames = Object.getOwnPropertyNames; | ||
@@ -1375,7 +1439,11 @@ var getOwnPropertySymbols = Object.getOwnPropertySymbols; | ||
const { name, as, attributes = [], selector } = component; | ||
if (!name || !as || selector || attributes.length > 0) return acc; | ||
if (!/^[\w-]+$/u.test(name)) return acc; | ||
if (!name || !as || selector || attributes.length > 0) { | ||
return acc; | ||
} | ||
if (!/^[\w-]+$/u.test(name)) { | ||
return acc; | ||
} | ||
return acc.set(name, as); | ||
}, /* @__PURE__ */ new Map()), | ||
version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => eff.E.getOrElse(getReactVersion(), eff.F.constant("19.0.0"))).otherwise(eff.F.identity) | ||
version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(eff.F.identity) | ||
}; | ||
@@ -1413,4 +1481,2 @@ }, { isEqual: shallowEqual }); | ||
exports.normalizeSettings = normalizeSettings; | ||
exports.normalizedSettingsCache = normalizedSettingsCache; | ||
exports.tryRequire = tryRequire; | ||
exports.unsafeDecodeSettings = unsafeDecodeSettings; |
{ | ||
"name": "@eslint-react/shared", | ||
"version": "1.23.2", | ||
"version": "1.23.3-beta.2", | ||
"description": "ESLint React's Shared constants and functions.", | ||
@@ -16,2 +16,3 @@ "homepage": "https://github.com/rEl1cx/eslint-react", | ||
"author": "Eva1ent<rel1cx@proton.me>", | ||
"sideEffects": false, | ||
"exports": { | ||
@@ -31,2 +32,3 @@ ".": { | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
@@ -41,11 +43,11 @@ "files": [ | ||
"ts-pattern": "^5.6.0", | ||
"@eslint-react/eff": "1.23.2" | ||
"@eslint-react/eff": "1.23.3-beta.2" | ||
}, | ||
"devDependencies": { | ||
"@types/picomatch": "^3.0.1", | ||
"fast-equals": "^5.2.0", | ||
"fast-equals": "^5.2.1", | ||
"micro-memoize": "^4.1.3", | ||
"tsup": "^8.3.5", | ||
"type-fest": "^4.31.0", | ||
"valibot": "^1.0.0-beta.10", | ||
"valibot": "^1.0.0-beta.11", | ||
"@workspace/configs": "0.0.0" | ||
@@ -57,4 +59,2 @@ }, | ||
}, | ||
"sideEffects": false, | ||
"module": "dist/index.mjs", | ||
"scripts": { | ||
@@ -61,0 +61,0 @@ "build": "tsup --dts-resolve", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
242618
5061
2
1
+ Added@eslint-react/eff@1.23.3-beta.2(transitive)
- Removed@eslint-react/eff@1.23.2(transitive)