localedate 0.0.1-security → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of localedate might be problematic. Click here for more details.

package/README.md CHANGED
@@ -1,5 +1,111 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=localedate for more information.
1
+ # reactnode
2
+
3
+ reactnode is a lightweight utility library focused on providing type-safe validation, inspection, and safe element creation for React components used in Node.js environments. It is suited for SSR tools, command-line utilities, testing frameworks, and any workflow that requires React without a browser DOM.
4
+
5
+ ## Features
6
+
7
+ - Type-safe validation of React component props
8
+ - Node-safe React element creation helpers
9
+ - Component-type detection (functional vs class)
10
+ - Prop-shape introspection utilities
11
+ - Full TypeScript support with bundled type declarations
12
+ - Zero external configuration required
13
+
14
+ ## Installation
15
+
16
+ npm install reactnode
17
+ yarn add reactnode
18
+ pnpm add reactnode
19
+
20
+ ## Usage
21
+
22
+ Example: validating a component's props
23
+
24
+ import { validateComponentProps } from "reactnode";
25
+ import React from "react";
26
+
27
+ function Button(props: { label: string; disabled?: boolean }) {
28
+ return React.createElement("button", { disabled: props.disabled }, props.label);
29
+ }
30
+
31
+ const result = validateComponentProps(Button, { label: "Click me" });
32
+
33
+ console.log(result.success);
34
+ console.log(result.errors);
35
+
36
+ Example: detecting component types
37
+
38
+ import { isFunctionalComponent, isClassComponent } from "reactnode";
39
+ import React from "react";
40
+
41
+ function A() { return null; }
42
+
43
+ class B extends React.Component {
44
+ render() { return null; }
45
+ }
46
+
47
+ console.log(isFunctionalComponent(A));
48
+ console.log(isClassComponent(B));
49
+
50
+ Example: safe creation of React elements
51
+
52
+ import { safeCreateElement } from "reactnode";
53
+ import React from "react";
54
+
55
+ const element = safeCreateElement("div", { id: "root" }, "Hello");
56
+
57
+ console.log(element.type);
58
+ console.log(element.props.id);
59
+
60
+ ## API Overview
61
+
62
+ validateComponentProps(Component, props)
63
+ Validates props passed into a React component based on inferred prop types.
64
+ Returns an object with:
65
+ success: boolean
66
+ errors: string[]
67
+
68
+ isFunctionalComponent(Component)
69
+ Returns true if the provided component is a React function component.
70
+
71
+ isClassComponent(Component)
72
+ Returns true if the component is a React class component.
73
+
74
+ safeCreateElement(type, props, ...children)
75
+ A wrapper around React.createElement designed to behave safely in non-DOM environments, such as Node.js.
76
+
77
+ inspectProps(Component)
78
+ Extracts metadata describing the component's expected props, including names and optionality.
79
+
80
+ ## Build and Development
81
+
82
+ reactnode uses tsup for bundling. The build output includes:
83
+ lib/index.js (CommonJS)
84
+ lib/index.mjs (ES Module)
85
+ lib/index.d.ts (TypeScript type definitions)
86
+
87
+ Build the library:
88
+ npm run build
89
+
90
+ Start development mode:
91
+ npm run dev
92
+
93
+ ## Testing
94
+
95
+ reactnode uses Vitest for testing.
96
+ Run tests with:
97
+ npm test
98
+
99
+ ## Package Contents
100
+
101
+ The published package includes only:
102
+ lib/
103
+ README.md
104
+ package.json
105
+ LICENSE
106
+
107
+ TypeScript source files are excluded from the published bundle.
108
+
109
+ ## License
110
+
111
+ MIT License
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export default function (locale: string): any;