Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
MarlonPassos-git committed Aug 20, 2024
1 parent 50cd479 commit 32e609d
Show file tree
Hide file tree
Showing 128 changed files with 2,694 additions and 2,694 deletions.
166 changes: 85 additions & 81 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,83 +1,87 @@
{
"name": "radashi",
"version": "12.1.0",
"type": "module",
"description": "The modern, community-first TypeScript toolkit with all of the fast, readable, and minimal utility functions you need. Type-safe, dependency-free, tree-shakeable, fully tested.",
"repository": {
"url": "git+https://github.com/radashi-org/radashi.git"
},
"homepage": "https://radashi.js.org",
"author": "Alec Larson",
"contributors": ["Ray Epps"],
"license": "MIT",
"packageManager": "pnpm@9.1.3",
"engines": {
"node": ">=16.0.0"
},
"main": "dist/radashi.cjs",
"module": "dist/radashi.js",
"exports": {
"require": {
"types": "./dist/radashi.d.cts",
"default": "./dist/radashi.cjs"
},
"types": "./dist/radashi.d.ts",
"default": "./dist/radashi.js"
},
"types": "dist/radashi.d.cts",
"files": ["dist"],
"scripts": {
"add-function": "bash ./scripts/add-function.sh",
"bench": "vitest bench",
"build": "tsup --clean",
"bundle-impact": "bash ./scripts/bundle-impact.sh",
"dev": "tsup --clean --watch --sourcemap",
"format": "bash ./scripts/format.sh",
"lint": "bash ./scripts/lint.sh",
"move-function": "bash ./scripts/move-function.sh",
"prepublishOnly": "tsc && biome check --fix && pnpm -s build",
"release": "bash ./scripts/release.sh",
"test": "vitest run --coverage",
"test-branch": "bash ./scripts/test-branch.sh",
"test-single": "bash ./scripts/test-single.sh",
"update-browserslist": "bash ./scripts/update-browserslist.sh"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@vitest/coverage-v8": "2.0.5",
"cspell": "^8.13.3",
"prettier": "^3.3.2",
"prettier-plugin-pkg": "^0.18.1",
"prettier-plugin-sh": "^0.14.0",
"tsup": "^8.1.0",
"typescript": "^5.5.2",
"vitest": "2.0.5"
},
"sideEffects": false,
"browserslist": [
"and_chr >= 57",
"chrome >= 57",
"and_ff >= 52",
"android >= 127",
"edge >= 15",
"samsung >= 7.4",
"safari >= 10.1",
"ios_saf >= 10.3",
"opera >= 44",
"firefox >= 52",
"unreleased and_chr versions",
"unreleased chrome versions",
"unreleased and_ff versions",
"unreleased android versions",
"unreleased edge versions",
"unreleased samsung versions",
"unreleased safari versions",
"unreleased ios_saf versions",
"unreleased opera versions",
"unreleased firefox versions",
"node >= 16"
],
"dependencies": {
"@radashi-org/biome-config": "link:scripts/biome-config"
}
"name": "radashi",
"version": "12.1.0",
"type": "module",
"description": "The modern, community-first TypeScript toolkit with all of the fast, readable, and minimal utility functions you need. Type-safe, dependency-free, tree-shakeable, fully tested.",
"repository": {
"url": "git+https://github.com/radashi-org/radashi.git"
},
"homepage": "https://radashi.js.org",
"author": "Alec Larson",
"contributors": [
"Ray Epps"
],
"license": "MIT",
"packageManager": "pnpm@9.1.3",
"engines": {
"node": ">=16.0.0"
},
"main": "dist/radashi.cjs",
"module": "dist/radashi.js",
"exports": {
"require": {
"types": "./dist/radashi.d.cts",
"default": "./dist/radashi.cjs"
},
"types": "./dist/radashi.d.ts",
"default": "./dist/radashi.js"
},
"types": "dist/radashi.d.cts",
"files": [
"dist"
],
"scripts": {
"add-function": "bash ./scripts/add-function.sh",
"bench": "vitest bench",
"build": "tsup --clean",
"bundle-impact": "bash ./scripts/bundle-impact.sh",
"dev": "tsup --clean --watch --sourcemap",
"format": "bash ./scripts/format.sh",
"lint": "bash ./scripts/lint.sh",
"move-function": "bash ./scripts/move-function.sh",
"prepublishOnly": "tsc && biome check --fix && pnpm -s build",
"release": "bash ./scripts/release.sh",
"test": "vitest run --coverage",
"test-branch": "bash ./scripts/test-branch.sh",
"test-single": "bash ./scripts/test-single.sh",
"update-browserslist": "bash ./scripts/update-browserslist.sh"
},
"dependencies": {
"@radashi-org/biome-config": "link:scripts/biome-config"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@vitest/coverage-v8": "2.0.5",
"cspell": "^8.13.3",
"prettier": "^3.3.2",
"prettier-plugin-pkg": "^0.18.1",
"prettier-plugin-sh": "^0.14.0",
"tsup": "^8.1.0",
"typescript": "^5.5.2",
"vitest": "2.0.5"
},
"sideEffects": false,
"browserslist": [
"and_chr >= 57",
"chrome >= 57",
"and_ff >= 52",
"android >= 127",
"edge >= 15",
"samsung >= 7.4",
"safari >= 10.1",
"ios_saf >= 10.3",
"opera >= 44",
"firefox >= 52",
"unreleased and_chr versions",
"unreleased chrome versions",
"unreleased and_ff versions",
"unreleased android versions",
"unreleased edge versions",
"unreleased samsung versions",
"unreleased safari versions",
"unreleased ios_saf versions",
"unreleased opera versions",
"unreleased firefox versions",
"node >= 16"
]
}
68 changes: 34 additions & 34 deletions scripts/benchmarks/src/dedent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isArray } from "radashi/typed/isArray.js";
import { isArray } from 'radashi/typed/isArray.js'

/**
* Remove indentation from a string. The given string is expected to
Expand Down Expand Up @@ -36,51 +36,51 @@ import { isArray } from "radashi/typed/isArray.js";
* ```
*/
export function dedent(
template: TemplateStringsArray,
...values: unknown[]
): string;
template: TemplateStringsArray,
...values: unknown[]
): string

export function dedent(text: string, indent?: string | null): string;
export function dedent(text: string, indent?: string | null): string

export function dedent(
text: string | TemplateStringsArray,
...values: unknown[]
text: string | TemplateStringsArray,
...values: unknown[]
): string {
// Support tagged template strings
if (isArray(text)) {
if (values.length > 0) {
return dedent(
text.reduce((acc, input, i) => {
let value = String(values[i] ?? "");
// Support tagged template strings
if (isArray(text)) {
if (values.length > 0) {
return dedent(
text.reduce((acc, input, i) => {
let value = String(values[i] ?? '')

// Detect the indentation before this embedded string.
const indent =
value.includes("\n") && input.match(/[ \t]*(?=[^\n]*$)/)?.[0];
// Detect the indentation before this embedded string.
const indent =
value.includes('\n') && input.match(/[ \t]*(?=[^\n]*$)/)?.[0]

// Ensure the multi-line, embedded string can be correctly
// dedented.
if (indent) {
value = value.replace(/\n(?=[^\n]*?\S)/g, "\n" + indent);
}
// Ensure the multi-line, embedded string can be correctly
// dedented.
if (indent) {
value = value.replace(/\n(?=[^\n]*?\S)/g, '\n' + indent)
}

return acc + input + value;
}, ""),
);
}
return acc + input + value
}, ''),
)
}

text = text[0];
}
text = text[0]
}

const indent = values[0] ?? detectIndent(text);
const output = indent
? text.replace(new RegExp(`^${indent}`, "gm"), "")
: text;
const indent = values[0] ?? detectIndent(text)
const output = indent
? text.replace(new RegExp(`^${indent}`, 'gm'), '')
: text

// Remove the first and last lines (if empty).
return output.replace(/^[ \t]*\n|\n[ \t]*$/g, "");
// Remove the first and last lines (if empty).
return output.replace(/^[ \t]*\n|\n[ \t]*$/g, '')
}

// Find the indentation of the first non-empty line.
function detectIndent(text: string) {
return text.match(/^[ \t]*(?=\S)/m)?.[0];
return text.match(/^[ \t]*(?=\S)/m)?.[0]
}
62 changes: 33 additions & 29 deletions scripts/biome-config/package.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
{
"name": "@radashi-org/biome-config",
"version": "1.0.0",
"description": "Shared Biome config for Radashi projects",
"keywords": [
"radashi",
"biome",
"biomejs",
"config",
"configuration",
"formatter",
"linter"
],
"repository": {
"url": "git+https://github.com/radashi-org/radashi.git"
},
"homepage": "https://radashi.js.org",
"license": "MIT",
"author": {
"name": "Alec Larson"
},
"exports": {
".": "./biome.json"
},
"main": "biome.json",
"files": ["biome.json"],
"peerDependencies": {
"@biomejs/biome": "^1.8.3"
},
"trustedDependencies": ["@biomejs/biome"]
"name": "@radashi-org/biome-config",
"version": "1.0.0",
"description": "Shared Biome config for Radashi projects",
"repository": {
"url": "git+https://github.com/radashi-org/radashi.git"
},
"homepage": "https://radashi.js.org",
"author": {
"name": "Alec Larson"
},
"license": "MIT",
"main": "biome.json",
"exports": {
".": "./biome.json"
},
"files": [
"biome.json"
],
"keywords": [
"radashi",
"biome",
"biomejs",
"config",
"configuration",
"formatter",
"linter"
],
"peerDependencies": {
"@biomejs/biome": "^1.8.3"
},
"trustedDependencies": [
"@biomejs/biome"
]
}
Loading

0 comments on commit 32e609d

Please sign in to comment.