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,49 @@
import { describe, expect, it } from 'vitest';
import { isDataURI, dataURItoByteString } from './utils.js';
describe('isDataURI()', () => {
it.each`
input | expectedResult
${'potato'} | ${false}
${'data:,Hello%2C%20world%21'} | ${true}
${'data:text/plain;base64,SGVsbG8sIHdvcmxkIQ=='} | ${true}
`('returns $expectedResult given $input', ({ input, expectedResult }) => {
const result = isDataURI(input);
expect(result).toBe(expectedResult);
});
});
describe('dataURItoByteString()', () => {
it('throws given invalid data URI', () => {
expect(() => dataURItoByteString('potato')).toThrow();
});
it('returns a byte string given plain text data URI', () => {
const result = dataURItoByteString('data:,Hello%2C%20world%21');
expect(result).toBe('Hello, world!');
});
it('returns a byte string given base64 data URI', () => {
const result = dataURItoByteString('data:text/plain;base64,SGVsbG8sIHdvcmxkIQ==');
expect(result).toBe('Hello, world!');
});
it('returns a byte string given base64 PDF data URI', () => {
const result = dataURItoByteString(
'data:application/pdf;base64,JVBERi0xLg10cmFpbGVyPDwvUm9vdDw8L1BhZ2VzPDwvS2lkc1s8PC9NZWRpYUJveFswIDAgMyAzXT4+XT4+Pj4+Pg==',
);
expect(result).toBe('%PDF-1.\rtrailer<</Root<</Pages<</Kids[<</MediaBox[0 0 3 3]>>]>>>>>>');
});
it('returns a byte string given base64 PDF data URI with filename', () => {
const result = dataURItoByteString(
'data:application/pdf;filename=generated.pdf;base64,JVBERi0xLg10cmFpbGVyPDwvUm9vdDw8L1BhZ2VzPDwvS2lkc1s8PC9NZWRpYUJveFswIDAgMyAzXT4+XT4+Pj4+Pg==',
);
expect(result).toBe('%PDF-1.\rtrailer<</Root<</Pages<</Kids[<</MediaBox[0 0 3 3]>>]>>>>>>');
});
});

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = setFunctionName;
function setFunctionName(fn, name, prefix) {
if (typeof name === "symbol") {
name = name.description;
name = name ? "[" + name + "]" : "";
}
try {
Object.defineProperty(fn, "name", {
configurable: true,
value: prefix ? prefix + " " + name : name
});
} catch (_) {}
return fn;
}
//# sourceMappingURL=setFunctionName.js.map

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"1":"K D E F A B","16":"mC"},B:{"1":"0 9 C L M G N O P Q H 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 q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 K D E F A B C L M G N O P 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 MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"nC LC J PB qC rC"},D:{"1":"0 9 yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H 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 q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P 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 MC wB NC xB"},E:{"1":"L M G xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K D E F A B C sC SC tC uC vC wC TC FC GC"},F:{"1":"0 nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD"},H:{"2":"WD"},I:{"2":"LC J I XD YD ZD aD lC bD cD"},J:{"16":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"16":"A B"},O:{"1":"HC"},P:{"2":"1 2 3 4 5 6 7 8 dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD","16":"J"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:1,C:"Printing Events",D:true};

View File

@@ -0,0 +1,126 @@
#!/usr/bin/env node
'use strict';
/*eslint-disable no-console*/
var fs = require('fs');
var argparse = require('argparse');
var yaml = require('..');
////////////////////////////////////////////////////////////////////////////////
var cli = new argparse.ArgumentParser({
prog: 'js-yaml',
add_help: true
});
cli.add_argument('-v', '--version', {
action: 'version',
version: require('../package.json').version
});
cli.add_argument('-c', '--compact', {
help: 'Display errors in compact mode',
action: 'store_true'
});
// deprecated (not needed after we removed output colors)
// option suppressed, but not completely removed for compatibility
cli.add_argument('-j', '--to-json', {
help: argparse.SUPPRESS,
dest: 'json',
action: 'store_true'
});
cli.add_argument('-t', '--trace', {
help: 'Show stack trace on error',
action: 'store_true'
});
cli.add_argument('file', {
help: 'File to read, utf-8 encoded without BOM',
nargs: '?',
default: '-'
});
////////////////////////////////////////////////////////////////////////////////
var options = cli.parse_args();
////////////////////////////////////////////////////////////////////////////////
function readFile(filename, encoding, callback) {
if (options.file === '-') {
// read from stdin
var chunks = [];
process.stdin.on('data', function (chunk) {
chunks.push(chunk);
});
process.stdin.on('end', function () {
return callback(null, Buffer.concat(chunks).toString(encoding));
});
} else {
fs.readFile(filename, encoding, callback);
}
}
readFile(options.file, 'utf8', function (error, input) {
var output, isYaml;
if (error) {
if (error.code === 'ENOENT') {
console.error('File not found: ' + options.file);
process.exit(2);
}
console.error(
options.trace && error.stack ||
error.message ||
String(error));
process.exit(1);
}
try {
output = JSON.parse(input);
isYaml = false;
} catch (err) {
if (err instanceof SyntaxError) {
try {
output = [];
yaml.loadAll(input, function (doc) { output.push(doc); }, {});
isYaml = true;
if (output.length === 0) output = null;
else if (output.length === 1) output = output[0];
} catch (e) {
if (options.trace && err.stack) console.error(e.stack);
else console.error(e.toString(options.compact));
process.exit(1);
}
} else {
console.error(
options.trace && err.stack ||
err.message ||
String(err));
process.exit(1);
}
}
if (isYaml) console.log(JSON.stringify(output, null, ' '));
else console.log(yaml.dump(output));
});

View File

@@ -0,0 +1,51 @@
{
"name": "react",
"description": "React is a JavaScript library for building user interfaces.",
"keywords": [
"react"
],
"version": "19.1.0",
"homepage": "https://react.dev/",
"bugs": "https://github.com/facebook/react/issues",
"license": "MIT",
"files": [
"LICENSE",
"README.md",
"index.js",
"cjs/",
"compiler-runtime.js",
"jsx-runtime.js",
"jsx-runtime.react-server.js",
"jsx-dev-runtime.js",
"jsx-dev-runtime.react-server.js",
"react.react-server.js"
],
"main": "index.js",
"exports": {
".": {
"react-server": "./react.react-server.js",
"default": "./index.js"
},
"./package.json": "./package.json",
"./jsx-runtime": {
"react-server": "./jsx-runtime.react-server.js",
"default": "./jsx-runtime.js"
},
"./jsx-dev-runtime": {
"react-server": "./jsx-dev-runtime.react-server.js",
"default": "./jsx-dev-runtime.js"
},
"./compiler-runtime": {
"react-server": "./compiler-runtime.js",
"default": "./compiler-runtime.js"
}
},
"repository": {
"type": "git",
"url": "https://github.com/facebook/react.git",
"directory": "packages/react"
},
"engines": {
"node": ">=0.10.0"
}
}

View File

@@ -0,0 +1 @@
module.exports={C:{"108":0.62678,"109":0.04029,"114":0.25071,"115":1.33862,"118":0.08506,"119":0.04029,"121":0.04029,"122":0.04029,"128":0.04029,"130":14.35326,"133":0.04029,"134":0.04029,"135":0.75214,"136":0.87749,_:"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 52 53 54 55 56 57 58 59 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 110 111 112 113 116 117 120 123 124 125 126 127 129 131 132 137 138 139 140 3.5 3.6"},D:{"50":0.04029,"87":0.04029,"109":0.29101,"120":0.12536,"125":0.04029,"129":0.04029,"133":2.84737,"134":5.14855,_:"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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 83 84 85 86 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 119 121 122 123 124 126 127 128 130 131 132 135 136 137 138"},F:{"117":1.37892,_:"9 11 12 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 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"91":0.08506,"92":0.54172,"105":0.04029,"109":0.08506,"110":0.04029,"114":0.46113,"116":0.16565,"117":0.87749,"118":0.79691,"120":0.04029,"122":0.04029,"124":0.12536,"127":0.04029,"131":0.16565,"132":0.12536,"133":2.38624,"134":3.6398,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 93 94 95 96 97 98 99 100 101 102 103 104 106 107 108 111 112 113 115 119 121 123 125 126 128 129 130"},E:{_:"0 4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.2 16.3 16.4 16.5 17.0 17.2 17.3 17.4 17.5 18.0 18.2 18.4","15.6":1.42369,"16.6":0.04029,"17.1":0.04029,"17.6":0.29101,"18.1":0.08506,"18.3":2.17582},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00351,"5.0-5.1":0,"6.0-6.1":0.01054,"7.0-7.1":0.00703,"8.1-8.4":0,"9.0-9.2":0.00527,"9.3":0.0246,"10.0-10.2":0.00176,"10.3":0.04041,"11.0-11.2":0.18623,"11.3-11.4":0.0123,"12.0-12.1":0.00703,"12.2-12.5":0.17393,"13.0-13.1":0.00351,"13.2":0.00527,"13.3":0.00703,"13.4-13.7":0.0246,"14.0-14.4":0.06149,"14.5-14.8":0.07379,"15.0-15.1":0.04041,"15.2-15.3":0.04041,"15.4":0.04919,"15.5":0.05622,"15.6-15.8":0.69221,"16.0":0.09838,"16.1":0.20204,"16.2":0.10541,"16.3":0.18271,"16.4":0.04041,"16.5":0.07555,"16.6-16.7":0.82046,"17.0":0.04919,"17.1":0.08784,"17.2":0.06676,"17.3":0.09311,"17.4":0.18623,"17.5":0.41462,"17.6-17.7":1.20345,"18.0":0.33732,"18.1":1.10331,"18.2":0.49368,"18.3":10.31808,"18.4":0.15285},P:{"21":0.04079,"25":0.04079,"27":13.99102,_:"4 20 22 23 24 26 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0"},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0},K:{"0":0,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.5523},Q:{_:"14.9"},O:{_:"0"},H:{"0":0},L:{"0":24.91405}};

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"8":"K D E mC","129":"F A B"},B:{"1":"0 9 C L M G N O P Q H 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 q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 J PB K D E F A B C L M G N O P 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 MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC","2":"nC LC"},D:{"1":"0 7 8 9 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 MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H 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 q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","129":"1 2 3 4 5 6 J PB K D E F A B C L M G N O P QB"},E:{"1":"D E F A B C L M G uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","129":"J PB K tC","388":"sC SC"},F:{"1":"0 1 2 3 4 5 6 7 8 B C G N O P 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 wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 4C 5C 6C 7C FC kC 8C GC","2":"F"},G:{"1":"E CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","129":"SC 9C lC AD BD"},H:{"1":"WD"},I:{"1":"I bD cD","129":"LC J XD YD ZD aD lC"},J:{"1":"D A"},K:{"1":"A B C H FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"129":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:2,C:"CSS3 Media Queries",D:true};

View File

@@ -0,0 +1,41 @@
// Copyright 2017 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
'use strict';
const fs = require('fs');
/**
* The path where we can find the ldd
*/
const LDD_PATH = '/usr/bin/ldd';
/**
* Read the content of a file synchronous
*
* @param {string} path
* @returns {string}
*/
const readFileSync = (path) => fs.readFileSync(path, 'utf-8');
/**
* Read the content of a file
*
* @param {string} path
* @returns {Promise<string>}
*/
const readFile = (path) => new Promise((resolve, reject) => {
fs.readFile(path, 'utf-8', (err, data) => {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
module.exports = {
LDD_PATH,
readFileSync,
readFile
};

View File

@@ -0,0 +1,241 @@
import warning from 'tiny-warning'
import { createRoute } from './route'
import { useMatch } from './useMatch'
import { useLoaderDeps } from './useLoaderDeps'
import { useLoaderData } from './useLoaderData'
import { useSearch } from './useSearch'
import { useParams } from './useParams'
import { useNavigate } from './useNavigate'
import { useRouter } from './useRouter'
import type { UseParamsRoute } from './useParams'
import type { UseMatchRoute } from './useMatch'
import type { UseSearchRoute } from './useSearch'
import type {
AnyContext,
AnyRoute,
AnyRouter,
Constrain,
ConstrainLiteral,
FileBaseRouteOptions,
FileRoutesByPath,
LazyRouteOptions,
RegisteredRouter,
ResolveParams,
Route,
RouteById,
RouteConstraints,
RouteIds,
RouteLoaderFn,
UpdatableRouteOptions,
} from '@tanstack/router-core'
import type { UseLoaderDepsRoute } from './useLoaderDeps'
import type { UseLoaderDataRoute } from './useLoaderData'
import type { UseRouteContextRoute } from './useRouteContext'
export function createFileRoute<
TFilePath extends keyof FileRoutesByPath,
TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],
TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],
TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],
TFullPath extends
RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],
>(
path: TFilePath,
): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {
return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {
silent: true,
}).createRoute
}
/**
@deprecated It's no longer recommended to use the `FileRoute` class directly.
Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.
*/
export class FileRoute<
TFilePath extends keyof FileRoutesByPath,
TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],
TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],
TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],
TFullPath extends
RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],
> {
silent?: boolean
constructor(
public path: TFilePath,
_opts?: { silent: boolean },
) {
this.silent = _opts?.silent
}
createRoute = <
TSearchValidator = undefined,
TParams = ResolveParams<TPath>,
TRouteContextFn = AnyContext,
TBeforeLoadFn = AnyContext,
TLoaderDeps extends Record<string, any> = {},
TLoaderFn = undefined,
TChildren = unknown,
>(
options?: FileBaseRouteOptions<
TParentRoute,
TId,
TPath,
TSearchValidator,
TParams,
TLoaderDeps,
TLoaderFn,
AnyContext,
TRouteContextFn,
TBeforeLoadFn
> &
UpdatableRouteOptions<
TParentRoute,
TId,
TFullPath,
TParams,
TSearchValidator,
TLoaderFn,
TLoaderDeps,
AnyContext,
TRouteContextFn,
TBeforeLoadFn
>,
): Route<
TParentRoute,
TPath,
TFullPath,
TFilePath,
TId,
TSearchValidator,
TParams,
AnyContext,
TRouteContextFn,
TBeforeLoadFn,
TLoaderDeps,
TLoaderFn,
TChildren,
unknown
> => {
warning(
this.silent,
'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',
)
const route = createRoute(options as any)
;(route as any).isRoot = false
return route as any
}
}
/**
@deprecated It's recommended not to split loaders into separate files.
Instead, place the loader function in the the main route file, inside the
`createFileRoute('/path/to/file)(options)` options.
*/
export function FileRouteLoader<
TFilePath extends keyof FileRoutesByPath,
TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],
>(
_path: TFilePath,
): <TLoaderFn>(
loaderFn: Constrain<
TLoaderFn,
RouteLoaderFn<
TRoute['parentRoute'],
TRoute['types']['id'],
TRoute['types']['params'],
TRoute['types']['loaderDeps'],
TRoute['types']['routerContext'],
TRoute['types']['routeContextFn'],
TRoute['types']['beforeLoadFn']
>
>,
) => TLoaderFn {
warning(
false,
`FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \`createFileRoute('/path/to/file')(options)\` options`,
)
return (loaderFn) => loaderFn as any
}
export class LazyRoute<TRoute extends AnyRoute> {
options: {
id: string
} & LazyRouteOptions
constructor(
opts: {
id: string
} & LazyRouteOptions,
) {
this.options = opts
;(this as any).$$typeof = Symbol.for('react.memo')
}
useMatch: UseMatchRoute<TRoute['id']> = (opts) => {
return useMatch({
select: opts?.select,
from: this.options.id,
structuralSharing: opts?.structuralSharing,
} as any) as any
}
useRouteContext: UseRouteContextRoute<TRoute['id']> = (opts) => {
return useMatch({
from: this.options.id,
select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),
}) as any
}
useSearch: UseSearchRoute<TRoute['id']> = (opts) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
return useSearch({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.options.id,
} as any) as any
}
useParams: UseParamsRoute<TRoute['id']> = (opts) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
return useParams({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.options.id,
} as any) as any
}
useLoaderDeps: UseLoaderDepsRoute<TRoute['id']> = (opts) => {
return useLoaderDeps({ ...opts, from: this.options.id } as any)
}
useLoaderData: UseLoaderDataRoute<TRoute['id']> = (opts) => {
return useLoaderData({ ...opts, from: this.options.id } as any)
}
useNavigate = () => {
const router = useRouter()
return useNavigate({ from: router.routesById[this.options.id].fullPath })
}
}
export function createLazyRoute<
TRouter extends AnyRouter = RegisteredRouter,
TId extends string = string,
TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,
>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {
return (opts: LazyRouteOptions) => {
return new LazyRoute<TRoute>({
id: id,
...opts,
})
}
}
export function createLazyFileRoute<
TFilePath extends keyof FileRoutesByPath,
TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],
>(id: TFilePath) {
return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"SafeFragment.js","sources":["../../src/SafeFragment.tsx"],"sourcesContent":["import * as React from 'react'\n\nexport function SafeFragment(props: any) {\n return <>{props.children}</>\n}\n"],"names":[],"mappings":";AAEO,SAAS,aAAa,OAAY;AAChC,SAAA,oBAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAC3B;"}

View File

@@ -0,0 +1,2 @@
export * from 'zustand/vanilla';
export * from 'zustand/react';

View File

@@ -0,0 +1,142 @@
/**
* Implements a browser's Path2D api
* https://developer.mozilla.org/en-US/docs/Web/API/Path2D
*/
declare class Path2D implements IPath2D {
commands: PathCommand[];
constructor(path?: Path2D | string);
addPath(path: Path2D): void;
moveTo(x: number, y: number): void;
lineTo(x: number, y: number): void;
arc(x: number, y: number, r: number, start: number, end: number, ccw: boolean): void;
arcTo(x1: number, y1: number, x2: number, y2: number, r: number): void;
ellipse(x: number, y: number, rx: number, ry: number, angle: number, start: number, end: number, ccw: boolean): void;
closePath(): void;
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
rect(x: number, y: number, width: number, height: number): void;
roundRect(x: number, y: number, width: number, height: number, radii?: number | number[]): void;
}
declare function buildPath(ctx: ICanvasRenderingContext2D, commands: PathCommand[]): void;
type Command = "M" | "m" | "L" | "l" | "H" | "h" | "V" | "v" | "A" | "a" | "C" | "c" | "S" | "s" | "Q" | "q" | "T" | "t" | "Z" | "z" | "AC" | "AT" | "E" | "R" | "RR";
type MovePathCommand = ["m" | "M", number, number];
type LinePathCommand = ["l" | "L", number, number];
type HorizontalPathCommand = ["h" | "H", number];
type VerticalPathCommand = ["v" | "V", number];
type ArcPathCommand = ["a" | "A", number, number, number, boolean, boolean, number, number];
type CurvePathCommand = ["c" | "C", number, number, number, number, number, number];
type ShortCurvePathCommand = ["s" | "S", number, number, number, number];
type QuadraticCurvePathCommand = ["q" | "Q", number, number, number, number];
type ShortQuadraticCurvePathCommand = ["t" | "T", number, number];
type ClosePathCommand = ["z" | "Z"];
type ArcCommand = ["AC", number, number, number, number, number, boolean];
type ArcToCommand = ["AT", number, number, number, number, number];
type EllipseCommand = ["E", number, number, number, number, number, number, number, boolean];
type RectCommand = ["R", number, number, number, number];
type RoundRectCommand = ["RR", number, number, number, number, number | number[]];
type GenericCommand = [Command, ...(number | boolean | number[])[]];
type CanvasFillRule = "nonzero" | "evenodd";
type PathCommand = MovePathCommand | LinePathCommand | HorizontalPathCommand | VerticalPathCommand | ArcPathCommand | CurvePathCommand | ShortCurvePathCommand | QuadraticCurvePathCommand | ShortQuadraticCurvePathCommand | ClosePathCommand | ArcCommand | ArcToCommand | EllipseCommand | RectCommand | RoundRectCommand | GenericCommand;
interface IPath2D {
addPath(path: IPath2D): void;
moveTo(x: number, y: number): void;
lineTo(x: number, y: number): void;
arc(x: number, y: number, r: number, start: number, end: number, ccw: boolean): void;
arcTo(x1: number, y1: number, x2: number, y2: number, r: number): void;
ellipse(x: number, y: number, rx: number, ry: number, angle: number, start: number, end: number, ccw: boolean): void;
closePath(): void;
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
rect(x: number, y: number, width: number, height: number): void;
roundRect(x: number, y: number, width: number, height: number, radii: number | number[]): void;
}
interface ICanvasRenderingContext2D {
beginPath(): void;
save(): void;
translate(x: number, y: number): void;
rotate(angle: number): void;
scale(x: number, y: number): void;
restore(): void;
moveTo(x: number, y: number): void;
lineTo(x: number, y: number): void;
arc(x: number, y: number, r: number, start: number, end: number, ccw: boolean): void;
arcTo(x1: number, y1: number, x2: number, y2: number, r: number): void;
ellipse(x: number, y: number, rx: number, ry: number, angle: number, start: number, end: number, ccw: boolean): void;
closePath(): void;
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
rect(x: number, y: number, width: number, height: number): void;
isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean;
isPointInPath(path: Path2D, x: number, y: number, fillRule?: CanvasFillRule): boolean;
clip(fillRule?: CanvasFillRule): void;
clip(path: Path2D, fillRule?: CanvasFillRule): void;
fill(fillRule?: CanvasFillRule): void;
fill(path: Path2D, fillRule?: CanvasFillRule): void;
stroke(): void;
stroke(path: Path2D): void;
roundRect(x: number, y: number, width: number, height: number, radii: number | number[]): void;
}
interface ICanvasRenderingContext2DWithoutPath2D {
beginPath(): void;
save(): void;
translate(x: number, y: number): void;
rotate(angle: number): void;
scale(x: number, y: number): void;
restore(): void;
moveTo(x: number, y: number): void;
lineTo(x: number, y: number): void;
arc(x: number, y: number, r: number, start: number, end: number, ccw: boolean): void;
arcTo(x1: number, y1: number, x2: number, y2: number, r: number): void;
ellipse(x: number, y: number, rx: number, ry: number, angle: number, start: number, end: number, ccw: boolean): void;
closePath(): void;
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
rect(x: number, y: number, width: number, height: number): void;
isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean;
clip(fillRule?: CanvasFillRule): void;
fill(fillRule?: CanvasFillRule): void;
stroke(): void;
roundRect(x: number, y: number, width: number, height: number, radii: number | number[]): void;
}
type IPrototype<T> = {
prototype: T;
new (): T;
};
type PartialBy<T, K extends keyof T> = Omit<T, K> & {
[P in K]?: T[P];
};
type CanvasRenderingContext2DProt = IPrototype<ICanvasRenderingContext2D>;
/**
* Adds Path2D capabilities to CanvasRenderingContext2D stroke, fill and isPointInPath
* @param global - window like object containing a CanvasRenderingContext2D constructor
*/
declare function applyPath2DToCanvasRenderingContext(CanvasRenderingContext2D?: IPrototype<ICanvasRenderingContext2DWithoutPath2D>): void;
/**
* Polyfills roundRect on CanvasRenderingContext2D
* @param CanvasRenderingContext2D - CanvasRenderingContext2D constructor object
*/
declare function applyRoundRectToCanvasRenderingContext2D(CanvasRenderingContext2D?: IPrototype<PartialBy<ICanvasRenderingContext2D, "roundRect">>): void;
/**
* Polyfills roundRect on Path2D
* @param Path2D - Path2D constructor object
*/
declare function applyRoundRectToPath2D(P2D?: IPrototype<PartialBy<IPath2D, "roundRect">>): void;
/**
* parse an svg path data string. Generates an Array
* of commands where each command is an Array of the
* form `[command, arg1, arg2, ...]`
*
* https://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation
* @ignore
*
* @param {string} path
* @returns {array}
*/
declare function parsePath(path: string): PathCommand[];
declare function roundRect(this: IPath2D | ICanvasRenderingContext2D, x: number, y: number, width: number, height: number, radii?: number | number[]): void;
export { type ArcCommand, type ArcPathCommand, type ArcToCommand, type CanvasFillRule, type CanvasRenderingContext2DProt, type ClosePathCommand, type Command, type CurvePathCommand, type EllipseCommand, type GenericCommand, type HorizontalPathCommand, type ICanvasRenderingContext2D, type ICanvasRenderingContext2DWithoutPath2D, type IPath2D, type IPrototype, type LinePathCommand, type MovePathCommand, type PartialBy, Path2D, type PathCommand, type QuadraticCurvePathCommand, type RectCommand, type RoundRectCommand, type ShortCurvePathCommand, type ShortQuadraticCurvePathCommand, type VerticalPathCommand, applyPath2DToCanvasRenderingContext, applyRoundRectToCanvasRenderingContext2D, applyRoundRectToPath2D, buildPath, parsePath, roundRect };

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 G N O P Q H 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 q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M"},C:{"1":"0 9 lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB qC rC"},D:{"1":"0 9 aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H 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 q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB"},E:{"2":"J PB K D B C L M G sC SC tC uC vC FC GC xC yC zC UC","129":"TC","194":"E F A wC","257":"VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C"},F:{"1":"0 5 6 7 8 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 wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 F B C G N O P QB 4C 5C 6C 7C FC kC 8C GC"},G:{"2":"SC 9C lC AD BD CD ID JD KD LD MD ND OD PD QD RD SD UC","129":"HD","194":"E DD ED FD GD","257":"VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:1,C:"navigator.hardwareConcurrency",D:true};

View File

@@ -0,0 +1,45 @@
{
"name": "set-cookie-parser",
"version": "2.7.1",
"description": "Parses set-cookie headers into objects",
"homepage": "https://github.com/nfriedly/set-cookie-parser",
"repository": "nfriedly/set-cookie-parser",
"author": {
"name": "Nathan Friedly",
"url": "http://nfriedly.com/"
},
"files": [
"lib"
],
"main": "./lib/set-cookie.js",
"sideEffects": false,
"keywords": [
"set-cookie",
"set",
"cookie",
"cookies",
"header",
"parse",
"parser"
],
"devDependencies": {
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.11",
"mocha": "^10.3.0",
"prettier": "^3.2.5",
"pretty-quick": "^4.0.0",
"sinon": "^17.0.1"
},
"scripts": {
"lint": "eslint . --ignore-pattern '!.eslintrc.js'",
"test": "npm run lint && mocha",
"autofix": "npm run lint -- --fix",
"precommit": "npm test"
},
"license": "MIT",
"prettier": {
"trailingComma": "es5"
}
}

View File

@@ -0,0 +1,45 @@
{
"name": "@tailwindcss/node",
"version": "4.1.2",
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/tailwindlabs/tailwindcss.git",
"directory": "packages/@tailwindcss-node"
},
"bugs": "https://github.com/tailwindlabs/tailwindcss/issues",
"homepage": "https://tailwindcss.com",
"files": [
"dist/"
],
"publishConfig": {
"provenance": true,
"access": "public"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./require-cache": {
"types": "./dist/require-cache.d.ts",
"default": "./dist/require-cache.js"
},
"./esm-cache-loader": {
"types": "./dist/esm-cache.loader.d.mts",
"default": "./dist/esm-cache.loader.mjs"
}
},
"dependencies": {
"enhanced-resolve": "^5.18.1",
"jiti": "^2.4.2",
"lightningcss": "1.29.2",
"tailwindcss": "4.1.2"
},
"scripts": {
"build": "tsup-node",
"dev": "pnpm run build -- --watch"
}
}

View File

@@ -0,0 +1,15 @@
'use strict'
/*!
* Canvas - CanvasPattern
* Copyright (c) 2010 LearnBoost <tj@learnboost.com>
* MIT Licensed
*/
const bindings = require('./bindings')
module.exports = bindings.CanvasPattern
bindings.CanvasPattern.prototype.toString = function () {
return '[object CanvasPattern]'
}

View File

@@ -0,0 +1,66 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = removeTypeDuplicates;
var _index = require("../../validators/generated/index.js");
function getQualifiedName(node) {
return (0, _index.isIdentifier)(node) ? node.name : (0, _index.isThisExpression)(node) ? "this" : `${node.right.name}.${getQualifiedName(node.left)}`;
}
function removeTypeDuplicates(nodesIn) {
const nodes = Array.from(nodesIn);
const generics = new Map();
const bases = new Map();
const typeGroups = new Set();
const types = [];
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i];
if (!node) continue;
if (types.includes(node)) {
continue;
}
if ((0, _index.isTSAnyKeyword)(node)) {
return [node];
}
if ((0, _index.isTSBaseType)(node)) {
bases.set(node.type, node);
continue;
}
if ((0, _index.isTSUnionType)(node)) {
if (!typeGroups.has(node.types)) {
nodes.push(...node.types);
typeGroups.add(node.types);
}
continue;
}
const typeArgumentsKey = "typeParameters";
if ((0, _index.isTSTypeReference)(node) && node[typeArgumentsKey]) {
const typeArguments = node[typeArgumentsKey];
const name = getQualifiedName(node.typeName);
if (generics.has(name)) {
let existing = generics.get(name);
const existingTypeArguments = existing[typeArgumentsKey];
if (existingTypeArguments) {
existingTypeArguments.params.push(...typeArguments.params);
existingTypeArguments.params = removeTypeDuplicates(existingTypeArguments.params);
} else {
existing = typeArguments;
}
} else {
generics.set(name, node);
}
continue;
}
types.push(node);
}
for (const [, baseType] of bases) {
types.push(baseType);
}
for (const [, genericName] of generics) {
types.push(genericName);
}
return types;
}
//# sourceMappingURL=removeTypeDuplicates.js.map

View File

@@ -0,0 +1,274 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
configs: () => configs,
default: () => src_default,
rules: () => rules
});
module.exports = __toCommonJS(src_exports);
// src/only-export-components.ts
var reactComponentNameRE = /^[A-Z][a-zA-Z0-9]*$/u;
var onlyExportComponents = {
meta: {
messages: {
exportAll: "This rule can't verify that `export *` only exports components.",
namedExport: "Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components.",
anonymousExport: "Fast refresh can't handle anonymous components. Add a name to your export.",
localComponents: "Fast refresh only works when a file only exports components. Move your component(s) to a separate file.",
noExport: "Fast refresh only works when a file has exports. Move your component(s) to a separate file.",
reactContext: "Fast refresh only works when a file only exports components. Move your React context(s) to a separate file."
},
type: "problem",
schema: [
{
type: "object",
properties: {
allowExportNames: { type: "array", items: { type: "string" } },
allowConstantExport: { type: "boolean" },
customHOCs: { type: "array", items: { type: "string" } },
checkJS: { type: "boolean" }
},
additionalProperties: false
}
]
},
defaultOptions: [],
create: (context) => {
const {
allowExportNames,
allowConstantExport = false,
customHOCs = [],
checkJS = false
} = context.options[0] ?? {};
const filename = context.filename;
if (filename.includes(".test.") || filename.includes(".spec.") || filename.includes(".cy.") || filename.includes(".stories.")) {
return {};
}
const shouldScan = filename.endsWith(".jsx") || filename.endsWith(".tsx") || checkJS && filename.endsWith(".js");
if (!shouldScan)
return {};
const allowExportNamesSet = allowExportNames ? new Set(allowExportNames) : void 0;
const reactHOCs = ["memo", "forwardRef", ...customHOCs];
const canBeReactFunctionComponent = (init) => {
if (!init)
return false;
if (init.type === "ArrowFunctionExpression")
return true;
if (init.type === "CallExpression" && init.callee.type === "Identifier") {
return reactHOCs.includes(init.callee.name);
}
return false;
};
return {
Program(program) {
let hasExports = false;
let hasReactExport = false;
let reactIsInScope = false;
const localComponents = [];
const nonComponentExports = [];
const reactContextExports = [];
const handleExportIdentifier = (identifierNode, isFunction, init) => {
if (identifierNode.type !== "Identifier") {
nonComponentExports.push(identifierNode);
return;
}
if (allowExportNamesSet == null ? void 0 : allowExportNamesSet.has(identifierNode.name))
return;
if (allowConstantExport && init && (init.type === "Literal" || // 1, "foo"
init.type === "UnaryExpression" || // -1
init.type === "TemplateLiteral" || // `Some ${template}`
init.type === "BinaryExpression")) {
return;
}
if (isFunction) {
if (reactComponentNameRE.test(identifierNode.name)) {
hasReactExport = true;
} else {
nonComponentExports.push(identifierNode);
}
} else {
if (init && init.type === "CallExpression" && // createContext || React.createContext
(init.callee.type === "Identifier" && init.callee.name === "createContext" || init.callee.type === "MemberExpression" && init.callee.property.type === "Identifier" && init.callee.property.name === "createContext")) {
reactContextExports.push(identifierNode);
return;
}
if (init && // Switch to allowList?
notReactComponentExpression.has(init.type)) {
nonComponentExports.push(identifierNode);
return;
}
if (reactComponentNameRE.test(identifierNode.name)) {
hasReactExport = true;
} else {
nonComponentExports.push(identifierNode);
}
}
};
const handleExportDeclaration = (node) => {
var _a, _b;
if (node.type === "VariableDeclaration") {
for (const variable of node.declarations) {
handleExportIdentifier(
variable.id,
canBeReactFunctionComponent(variable.init),
variable.init
);
}
} else if (node.type === "FunctionDeclaration") {
if (node.id === null) {
context.report({ messageId: "anonymousExport", node });
} else {
handleExportIdentifier(node.id, true);
}
} else if (node.type === "CallExpression") {
if (node.callee.type === "CallExpression" && node.callee.callee.type === "Identifier" && node.callee.callee.name === "connect") {
hasReactExport = true;
} else if (node.callee.type !== "Identifier") {
if (node.callee.type === "MemberExpression" && node.callee.property.type === "Identifier" && reactHOCs.includes(node.callee.property.name)) {
hasReactExport = true;
} else {
context.report({ messageId: "anonymousExport", node });
}
} else if (!reactHOCs.includes(node.callee.name)) {
context.report({ messageId: "anonymousExport", node });
} else if (((_a = node.arguments[0]) == null ? void 0 : _a.type) === "FunctionExpression" && node.arguments[0].id) {
handleExportIdentifier(node.arguments[0].id, true);
} else if (((_b = node.arguments[0]) == null ? void 0 : _b.type) === "Identifier") {
hasReactExport = true;
} else {
context.report({ messageId: "anonymousExport", node });
}
} else if (node.type === "TSEnumDeclaration") {
nonComponentExports.push(node.id);
}
};
for (const node of program.body) {
if (node.type === "ExportAllDeclaration") {
if (node.exportKind === "type")
continue;
hasExports = true;
context.report({ messageId: "exportAll", node });
} else if (node.type === "ExportDefaultDeclaration") {
hasExports = true;
const declaration = node.declaration.type === "TSAsExpression" || node.declaration.type === "TSSatisfiesExpression" ? node.declaration.expression : node.declaration;
if (declaration.type === "VariableDeclaration" || declaration.type === "FunctionDeclaration" || declaration.type === "CallExpression") {
handleExportDeclaration(declaration);
}
if (declaration.type === "Identifier") {
handleExportIdentifier(declaration);
}
if (declaration.type === "ArrowFunctionExpression") {
context.report({ messageId: "anonymousExport", node });
}
} else if (node.type === "ExportNamedDeclaration") {
if (node.exportKind === "type")
continue;
hasExports = true;
if (node.declaration)
handleExportDeclaration(node.declaration);
for (const specifier of node.specifiers) {
handleExportIdentifier(
specifier.exported.type === "Identifier" && specifier.exported.name === "default" ? specifier.local : specifier.exported
);
}
} else if (node.type === "VariableDeclaration") {
for (const variable of node.declarations) {
if (variable.id.type === "Identifier" && reactComponentNameRE.test(variable.id.name) && canBeReactFunctionComponent(variable.init)) {
localComponents.push(variable.id);
}
}
} else if (node.type === "FunctionDeclaration") {
if (reactComponentNameRE.test(node.id.name)) {
localComponents.push(node.id);
}
} else if (node.type === "ImportDeclaration" && node.source.value === "react") {
reactIsInScope = true;
}
}
if (checkJS && !reactIsInScope)
return;
if (hasExports) {
if (hasReactExport) {
for (const node of nonComponentExports) {
context.report({ messageId: "namedExport", node });
}
for (const node of reactContextExports) {
context.report({ messageId: "reactContext", node });
}
} else if (localComponents.length) {
for (const node of localComponents) {
context.report({ messageId: "localComponents", node });
}
}
} else if (localComponents.length) {
for (const node of localComponents) {
context.report({ messageId: "noExport", node });
}
}
}
};
}
};
var notReactComponentExpression = /* @__PURE__ */ new Set([
"ArrayExpression",
"AwaitExpression",
"BinaryExpression",
"ChainExpression",
"ConditionalExpression",
"Literal",
"LogicalExpression",
"ObjectExpression",
"TemplateLiteral",
"ThisExpression",
"UnaryExpression",
"UpdateExpression"
]);
// src/index.ts
var rules = {
"only-export-components": onlyExportComponents
};
var plugin = { rules };
var configs = {
recommended: {
name: "react-refresh/recommended",
plugins: { "react-refresh": plugin },
rules: { "react-refresh/only-export-components": "error" }
},
vite: {
name: "react-refresh/vite",
plugins: { "react-refresh": plugin },
rules: {
"react-refresh/only-export-components": [
"error",
{ allowConstantExport: true }
]
}
}
};
var src_default = { rules, configs };
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
configs,
rules
});