h3 1.0.0 → 1.0.1
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.
- package/LICENSE +21 -0
- package/README.md +142 -25
- package/dist/index.cjs +914 -0
- package/dist/index.d.ts +304 -0
- package/dist/index.mjs +850 -0
- package/package.json +57 -11
- package/LICENSE.txt +0 -13
- package/index.js +0 -53
package/package.json
CHANGED
|
@@ -1,13 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "h3",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Tiny JavaScript Server",
|
|
5
|
+
"repository": "unjs/h3",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
"./package.json": "./package.json",
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/index.cjs",
|
|
17
|
+
"module": "./dist/index.mjs",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "unbuild",
|
|
24
|
+
"dev": "vitest",
|
|
25
|
+
"lint": "eslint --ext ts,mjs,cjs .",
|
|
26
|
+
"play": "jiti ./playground/index.ts",
|
|
27
|
+
"profile": "0x -o -D .profile -P 'autocannon -c 100 -p 10 -d 40 http://localhost:$PORT' ./playground/server.cjs",
|
|
28
|
+
"release": "pnpm test && pnpm build && changelogen --release && pnpm publish && git push --follow-tags",
|
|
29
|
+
"test": "pnpm lint && vitest run --coverage"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"cookie-es": "^0.5.0",
|
|
33
|
+
"destr": "^1.2.1",
|
|
34
|
+
"radix3": "^1.0.0",
|
|
35
|
+
"ufo": "^1.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"0x": "^5.4.1",
|
|
39
|
+
"@types/express": "^4.17.14",
|
|
40
|
+
"@types/node": "^18.11.9",
|
|
41
|
+
"@types/supertest": "^2.0.12",
|
|
42
|
+
"@vitest/coverage-c8": "^0.25.2",
|
|
43
|
+
"autocannon": "^7.10.0",
|
|
44
|
+
"changelogen": "^0.4.0",
|
|
45
|
+
"connect": "^3.7.0",
|
|
46
|
+
"eslint": "^8.27.0",
|
|
47
|
+
"eslint-config-unjs": "^0.0.2",
|
|
48
|
+
"express": "^4.18.2",
|
|
49
|
+
"get-port": "^6.1.2",
|
|
50
|
+
"jiti": "^1.16.0",
|
|
51
|
+
"listhen": "^1.0.0",
|
|
52
|
+
"node-fetch-native": "^1.0.1",
|
|
53
|
+
"supertest": "^6.3.1",
|
|
54
|
+
"typescript": "^4.8.4",
|
|
55
|
+
"unbuild": "^0.9.4",
|
|
56
|
+
"vitest": "^0.25.2"
|
|
57
|
+
},
|
|
58
|
+
"packageManager": "pnpm@7.16.0"
|
|
59
|
+
}
|
package/LICENSE.txt
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2016, Tristan Berger <tristanberger@gmail.com>
|
|
2
|
-
|
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
4
|
-
with or without fee is hereby granted, provided that the above copyright notice
|
|
5
|
-
and this permission notice appear in all copies.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
9
|
-
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
11
|
-
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
12
|
-
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
13
|
-
THIS SOFTWARE.
|
package/index.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var doc = document;
|
|
4
|
-
|
|
5
|
-
function h(tagName, props) {
|
|
6
|
-
if (typeof tagName !== 'string') {
|
|
7
|
-
throw Error('tagName must be a string');
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
var el = doc.createElement(tagName);
|
|
11
|
-
|
|
12
|
-
if (!props) {
|
|
13
|
-
// pass
|
|
14
|
-
} else if (typeof props === 'string') {
|
|
15
|
-
el.className = props;
|
|
16
|
-
} else if (typeof props === 'object') {
|
|
17
|
-
for (var key in props) {
|
|
18
|
-
if (key === 'style') {
|
|
19
|
-
el.style.cssText = props[key];
|
|
20
|
-
} else {
|
|
21
|
-
el[key] = props[key];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
} else {
|
|
25
|
-
throw Error('props must be an object, a string, or falsy');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
var parent = el.content || el;
|
|
29
|
-
|
|
30
|
-
for (var i = 2, len = arguments.length; i < len; i++) {
|
|
31
|
-
append(parent, arguments[i]);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return el;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function append(parent, child) {
|
|
38
|
-
if (child instanceof Node) {
|
|
39
|
-
parent.appendChild(child);
|
|
40
|
-
} else if (typeof child === 'string') {
|
|
41
|
-
parent.appendChild(doc.createTextNode(child));
|
|
42
|
-
} else if (!child) {
|
|
43
|
-
// pass
|
|
44
|
-
} else if (Array.isArray(child)) {
|
|
45
|
-
for (var i = 0, len = child.length; i < len; i++) {
|
|
46
|
-
append(parent, child[i]);
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
throw Error('children must be Nodes, strings, Arrays, or falsy');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
module.exports = h;
|