@starbeam/core-utils
Advanced tools
Comparing version 0.8.10-unstable.c41f68b to 0.8.10-unstable.d342d90
{ | ||
"root": true, | ||
"ignorePatterns": ["node_modules", "dist", "html", "tests"], | ||
"plugins": ["@starbeam"], | ||
"overrides": [ | ||
{ | ||
"extends": ["plugin:@starbeam/tight"], | ||
"files": ["index.ts", "src/**/*.ts"], | ||
"parserOptions": { | ||
"project": "tsconfig.json" | ||
} | ||
}, | ||
{ | ||
"extends": ["plugin:@starbeam/json:recommended"], | ||
"files": ["*.json"] | ||
} | ||
] | ||
"extends": ["plugin:@starbeam-dev/library:recommended"] | ||
} |
150
CHANGELOG.md
@@ -1,150 +0,2 @@ | ||
# @starbeam/core-utils | ||
# Changelog | ||
## 0.8.9 | ||
### Patch Changes | ||
- e459bf2: Fix CJS builds | ||
## 0.8.8 | ||
### Patch Changes | ||
- 2a1f728: Improve @starbeam/react | ||
## 0.8.7 | ||
### Patch Changes | ||
- 14f961b: Fixes #75 | ||
## 0.8.7 | ||
### Patch Changes | ||
- ded6421: Add /setup to preact | ||
## 0.8.6 | ||
### Patch Changes | ||
- 6502cc7: Remove errant import | ||
## 0.8.5 | ||
### Patch Changes | ||
- de755c6: Improve type inference | ||
## 0.8.4 | ||
### Patch Changes | ||
- 3bf1221: Prepare for Starbeam 0.8.4 | ||
## 0.8.0 | ||
### Minor Changes | ||
- 1a553c5: Prepare for 0.8 | ||
## 0.7.3 | ||
### Patch Changes | ||
- 40844fd: Try to fix the build | ||
## 0.7.2 | ||
### Patch Changes | ||
- 50f7a8f: Publish @domtree | ||
- Updated dependencies [50f7a8f] | ||
- @starbeam/shared@1.2.1 | ||
## 0.7.0 | ||
### Minor Changes | ||
- 58f7974: Starbeam 0.7.0 | ||
- Significant improvements to debugging infrastructure | ||
### Patch Changes | ||
- Updated dependencies [58f7974] | ||
- @starbeam/shared@1.2.0 | ||
## 0.6.0 | ||
### Minor Changes | ||
- Prepare 0.6.0 | ||
### Patch Changes | ||
- Updated dependencies | ||
- @starbeam/shared@1.1.0 | ||
## 0.5.8 | ||
### Patch Changes | ||
- Prepare 0.5.8 | ||
- Updated dependencies | ||
- @starbeam/shared@1.0.8 | ||
## 0.5.7 | ||
### Patch Changes | ||
- Fix a bug in the transition from uninitialized to initialized reactive Map | ||
- Updated dependencies | ||
- @starbeam/shared@1.0.7 | ||
## 0.5.6 | ||
### Patch Changes | ||
- Fix ESM package mistakes | ||
- Updated dependencies | ||
- @starbeam/shared@1.0.6 | ||
## 0.5.5 | ||
### Patch Changes | ||
- Another attempt to get the build right | ||
- Updated dependencies | ||
- @starbeam/shared@1.0.5 | ||
## 0.5.4 | ||
### Patch Changes | ||
- The 0.5.3 release was missing dists | ||
- Updated dependencies | ||
- @starbeam/shared@1.0.4 | ||
## 0.5.3 | ||
### Patch Changes | ||
- d21391d: Update resources to support React's three-phase lifecycle | ||
- Updated dependencies [d21391d] | ||
- @starbeam/shared@1.0.3 | ||
## 0.5.2 | ||
### Patch Changes | ||
- 719a6fe: Updated package export maps | ||
- Updated dependencies [719a6fe] | ||
- @starbeam/shared@1.0.2 | ||
## 0.5.1 | ||
### Patch Changes | ||
- 2a957e5: Try to fix types | ||
- e03c2a0: Initial publish |
19
index.ts
@@ -29,14 +29,2 @@ export { | ||
export { type UnknownFn } from "./src/function.js"; | ||
export { | ||
DisplayStruct, | ||
type DisplayStructOptions, | ||
} from "./src/inspect/display-struct.js"; | ||
export { | ||
DEBUG, | ||
DEBUG_NAME, | ||
INSPECT, | ||
type Inspect, | ||
inspect, | ||
inspector, | ||
} from "./src/inspect/inspect-support.js"; | ||
export { iterableHasItems, reverse } from "./src/iterable.js"; | ||
@@ -63,9 +51,2 @@ export type { | ||
export { type Matcher, Overload, type TypedOverload } from "./src/overload.js"; | ||
export { isEmptyMatch, matchPattern, Pattern } from "./src/regexp.js"; | ||
export { | ||
asIntIndex, | ||
isPresentString, | ||
stringify, | ||
TO_STRING, | ||
} from "./src/string.js"; | ||
export { isPresent } from "./src/value.js"; |
{ | ||
"name": "@starbeam/core-utils", | ||
"version": "0.8.10-unstable.c41f68b", | ||
"type": "module", | ||
"main": "index.ts", | ||
"types": "index.ts", | ||
"version": "0.8.10-unstable.d342d90", | ||
"main": "dist/index.cjs", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
"default": "./index.ts" | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js", | ||
"default": "./dist/index.cjs" | ||
}, | ||
"publishConfig": { | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js", | ||
"default": "./dist/index.cjs" | ||
} | ||
}, | ||
"main": "dist/index.cjs", | ||
"types": "dist/index.d.ts" | ||
}, | ||
"starbeam": { | ||
"type": "library:public" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@starbeam-dev/compile": "^1.1.0", | ||
"@starbeam-dev/eslint-plugin": "^1.0.4", | ||
"rollup": "^4.0.2" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c", | ||
"test:lint": "eslint . --max-warnings 0", | ||
"test:specs": "vitest --run", | ||
"test:specs": "vitest --run --pool forks", | ||
"test:types": "tsc -b" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@starbeam/eslint-plugin": "workspace:^", | ||
"@starbeam-dev/build-support": "workspace:^", | ||
"rollup": "^3.29.2" | ||
} | ||
} | ||
} |
@@ -13,5 +13,7 @@ /* eslint-disable @typescript-eslint/no-magic-numbers -- this file absorbs magic | ||
type PresentArrayFor<T extends unknown[] | readonly unknown[] | undefined> = | ||
T extends readonly (infer Item)[] | (infer Item)[] | ||
? readonly [Item, ...Item[]] | ||
: never; | ||
T extends (infer Item)[] | ||
? [Item, ...Item[]] | ||
: T extends readonly (infer Item)[] | ||
? readonly [Item, ...Item[]] | ||
: never; | ||
@@ -282,1 +284,45 @@ export function isPresentArray< | ||
} | ||
if (import.meta.vitest) { | ||
const { describe, test, expect } = import.meta.vitest; | ||
describe("getLastIndex", () => { | ||
test("should return the last index of a non-empty array", () => { | ||
const array = [1, 2, 3]; | ||
expect(getLastIndex(array)).toBe(2); | ||
}); | ||
test("should return undefined for an empty array", () => { | ||
const array: number[] = []; | ||
expect(getLastIndex(array)).toBeUndefined(); | ||
}); | ||
}); | ||
describe("removeItemAt", () => { | ||
test("should remove item at a given index from the array", () => { | ||
const array = [1, 2, 3]; | ||
removeItemAt(array, 1); | ||
expect(array).toEqual([1, 3]); | ||
}); | ||
}); | ||
describe("removeItem", () => { | ||
test("should remove a given item from the array", () => { | ||
const array = [1, 2, 3]; | ||
removeItem(array, 2); | ||
expect(array).toEqual([1, 3]); | ||
}); | ||
}); | ||
describe("isArray", () => { | ||
test("should return true if the input is an array", () => { | ||
const array = [1, 2, 3]; | ||
expect(isArray(array)).toBe(true); | ||
}); | ||
test("should return false if the input is not an array", () => { | ||
const notArray = "not an array"; | ||
expect(isArray(notArray)).toBe(false); | ||
}); | ||
}); | ||
} |
@@ -15,1 +15,36 @@ import type { AnyArray, PresentArray } from "./array.js"; | ||
} | ||
if (import.meta.vitest) { | ||
const { test, describe, expect } = import.meta.vitest; | ||
describe("reverse", () => { | ||
test("should reverse an array", () => { | ||
const input = ["a", "b", "c"]; | ||
const output = reverse(input); | ||
expect(output).toEqual(["c", "b", "a"]); | ||
}); | ||
test("should reverse a set", () => { | ||
const input = new Set(["a", "b", "c"]); | ||
const output = reverse(input); | ||
expect(output).toEqual(["c", "b", "a"]); | ||
}); | ||
test("should return an empty array when input is empty", () => { | ||
expect(reverse([])).toEqual([]); | ||
expect(reverse(new Set())).toEqual([]); | ||
}); | ||
}); | ||
describe("iterableHasItems", () => { | ||
test("should return true when iterable has items", () => { | ||
expect(iterableHasItems(["a", "b", "c"])).toBe(true); | ||
expect(iterableHasItems(new Set(["a", "b", "c"]))).toBe(true); | ||
}); | ||
test("should return false when iterable is empty", () => { | ||
expect(iterableHasItems([])).toBe(false); | ||
expect(iterableHasItems(new Set())).toBe(false); | ||
}); | ||
}); | ||
} |
{ | ||
"root": true, | ||
"ignorePatterns": ["node_modules", "dist", "html", "tests"], | ||
"plugins": ["@starbeam"], | ||
"overrides": [ | ||
{ | ||
"extends": ["plugin:@starbeam/loose"], | ||
"files": ["**/*.ts"], | ||
"parserOptions": { | ||
"project": "tsconfig.json" | ||
} | ||
}, | ||
{ | ||
"extends": ["plugin:@starbeam/json:recommended"], | ||
"files": ["*.json"] | ||
} | ||
] | ||
"extends": ["plugin:@starbeam-dev/library:recommended"] | ||
} |
@@ -1,11 +0,7 @@ | ||
import { isObject } from "@starbeam/core-utils"; | ||
import { describe, expect, test } from "vitest"; | ||
describe("object utils", () => { | ||
test("isObject", () => { | ||
expect(isObject(null)).toBe(false); | ||
expect(isObject({})).toBe(true); | ||
expect(isObject(new (class {})())).toBe(true); | ||
expect(isObject([])).toBe(true); | ||
describe("now", () => { | ||
test("ok", () => { | ||
expect(true).toBe(true); | ||
}); | ||
}); |
{ | ||
"private": true, | ||
"name": "@starbeam-tests/core-utils", | ||
"type": "module", | ||
"version": "1.0.0", | ||
"type": "module", | ||
"starbeam": { | ||
@@ -18,4 +18,4 @@ "source": "tsx", | ||
"devDependencies": { | ||
"@starbeam/eslint-plugin": "workspace:^" | ||
"@starbeam-dev/eslint-plugin": "^1.0.4" | ||
} | ||
} |
@@ -5,9 +5,12 @@ { | ||
"composite": true, | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "react", | ||
"types": ["../../../env.d.ts"], | ||
"declaration": true, | ||
"declarationDir": "../../../../dist/types", | ||
"declarationMap": true, | ||
"outDir": "../../../../dist/packages", | ||
"types": ["../../../env"] | ||
"emitDeclarationOnly": true | ||
}, | ||
"include": ["**/*.ts"], | ||
"exclude": ["dist/**/*"] | ||
} |
@@ -5,9 +5,9 @@ { | ||
"composite": true, | ||
"types": ["../../env.d.ts"], | ||
"declaration": true, | ||
"declarationDir": "../../../dist/types", | ||
"declarationMap": true, | ||
"outDir": "../../../dist/packages", | ||
"types": ["../../env"] | ||
"emitDeclarationOnly": true | ||
}, | ||
"exclude": ["dist/**/*"] | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
174713
30
0
1677
1