nukejs 0.0.1 → 0.0.2
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 +529 -0
- package/bin/index.mjs +126 -0
- package/dist/app.d.ts +18 -0
- package/dist/app.js +124 -0
- package/dist/app.js.map +7 -0
- package/dist/as-is/Link.d.ts +6 -0
- package/dist/as-is/Link.tsx +20 -0
- package/dist/as-is/useRouter.d.ts +7 -0
- package/dist/as-is/useRouter.ts +33 -0
- package/dist/build-common.d.ts +192 -0
- package/dist/build-common.js +737 -0
- package/dist/build-common.js.map +7 -0
- package/dist/build-node.d.ts +1 -0
- package/dist/build-node.js +170 -0
- package/dist/build-node.js.map +7 -0
- package/dist/build-vercel.d.ts +1 -0
- package/dist/build-vercel.js +65 -0
- package/dist/build-vercel.js.map +7 -0
- package/dist/builder.d.ts +1 -0
- package/dist/builder.js +97 -0
- package/dist/builder.js.map +7 -0
- package/dist/bundle.d.ts +68 -0
- package/dist/bundle.js +166 -0
- package/dist/bundle.js.map +7 -0
- package/dist/bundler.d.ts +58 -0
- package/dist/bundler.js +98 -0
- package/dist/bundler.js.map +7 -0
- package/dist/component-analyzer.d.ts +72 -0
- package/dist/component-analyzer.js +102 -0
- package/dist/component-analyzer.js.map +7 -0
- package/dist/config.d.ts +35 -0
- package/dist/config.js +30 -0
- package/dist/config.js.map +7 -0
- package/dist/hmr-bundle.d.ts +25 -0
- package/dist/hmr-bundle.js +76 -0
- package/dist/hmr-bundle.js.map +7 -0
- package/dist/hmr.d.ts +55 -0
- package/dist/hmr.js +62 -0
- package/dist/hmr.js.map +7 -0
- package/dist/html-store.d.ts +121 -0
- package/dist/html-store.js +42 -0
- package/dist/html-store.js.map +7 -0
- package/dist/http-server.d.ts +99 -0
- package/dist/http-server.js +166 -0
- package/dist/http-server.js.map +7 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +7 -0
- package/dist/logger.d.ts +58 -0
- package/dist/logger.js +53 -0
- package/dist/logger.js.map +7 -0
- package/dist/metadata.d.ts +50 -0
- package/dist/metadata.js +43 -0
- package/dist/metadata.js.map +7 -0
- package/dist/middleware-loader.d.ts +50 -0
- package/dist/middleware-loader.js +50 -0
- package/dist/middleware-loader.js.map +7 -0
- package/dist/middleware.d.ts +22 -0
- package/dist/middleware.example.d.ts +8 -0
- package/dist/middleware.example.js +58 -0
- package/dist/middleware.example.js.map +7 -0
- package/dist/middleware.js +59 -0
- package/dist/middleware.js.map +7 -0
- package/dist/renderer.d.ts +44 -0
- package/dist/renderer.js +130 -0
- package/dist/renderer.js.map +7 -0
- package/dist/router.d.ts +84 -0
- package/dist/router.js +104 -0
- package/dist/router.js.map +7 -0
- package/dist/ssr.d.ts +39 -0
- package/dist/ssr.js +168 -0
- package/dist/ssr.js.map +7 -0
- package/dist/use-html.d.ts +64 -0
- package/dist/use-html.js +125 -0
- package/dist/use-html.js.map +7 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.js +62 -0
- package/dist/utils.js.map +7 -0
- package/package.json +64 -12
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* utils.ts — Shared Utility Functions
|
|
3
|
+
*
|
|
4
|
+
* Small, dependency-free helpers used across both server and client code.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Escapes a string for safe inclusion in HTML content or attribute values.
|
|
8
|
+
*
|
|
9
|
+
* Replaces the five characters that have special meaning in HTML:
|
|
10
|
+
* & → & (must come first to avoid double-escaping)
|
|
11
|
+
* < → <
|
|
12
|
+
* > → >
|
|
13
|
+
* " → "
|
|
14
|
+
* ' → '
|
|
15
|
+
*/
|
|
16
|
+
export declare function escapeHtml(str: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the correct Content-Type header value for a given file extension.
|
|
19
|
+
*
|
|
20
|
+
* Covers the full range of file types that are realistic in a public/ directory:
|
|
21
|
+
* scripts, styles, images, fonts, media, documents, and data formats.
|
|
22
|
+
*
|
|
23
|
+
* Falls back to 'application/octet-stream' for unknown extensions so the
|
|
24
|
+
* browser downloads rather than tries to render unknown binary content.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getMimeType(ext: string): string;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
function escapeHtml(str) {
|
|
2
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3
|
+
}
|
|
4
|
+
function getMimeType(ext) {
|
|
5
|
+
const map = {
|
|
6
|
+
// ── Web ────────────────────────────────────────────────────────────────
|
|
7
|
+
".html": "text/html; charset=utf-8",
|
|
8
|
+
".htm": "text/html; charset=utf-8",
|
|
9
|
+
".css": "text/css; charset=utf-8",
|
|
10
|
+
".js": "application/javascript; charset=utf-8",
|
|
11
|
+
".mjs": "application/javascript; charset=utf-8",
|
|
12
|
+
".cjs": "application/javascript; charset=utf-8",
|
|
13
|
+
".map": "application/json; charset=utf-8",
|
|
14
|
+
// ── Data ──────────────────────────────────────────────────────────────
|
|
15
|
+
".json": "application/json; charset=utf-8",
|
|
16
|
+
".xml": "application/xml; charset=utf-8",
|
|
17
|
+
".txt": "text/plain; charset=utf-8",
|
|
18
|
+
".csv": "text/csv; charset=utf-8",
|
|
19
|
+
// ── Images ────────────────────────────────────────────────────────────
|
|
20
|
+
".png": "image/png",
|
|
21
|
+
".jpg": "image/jpeg",
|
|
22
|
+
".jpeg": "image/jpeg",
|
|
23
|
+
".gif": "image/gif",
|
|
24
|
+
".webp": "image/webp",
|
|
25
|
+
".avif": "image/avif",
|
|
26
|
+
".svg": "image/svg+xml",
|
|
27
|
+
".ico": "image/x-icon",
|
|
28
|
+
".bmp": "image/bmp",
|
|
29
|
+
".tiff": "image/tiff",
|
|
30
|
+
".tif": "image/tiff",
|
|
31
|
+
// ── Fonts ─────────────────────────────────────────────────────────────
|
|
32
|
+
".woff": "font/woff",
|
|
33
|
+
".woff2": "font/woff2",
|
|
34
|
+
".ttf": "font/ttf",
|
|
35
|
+
".otf": "font/otf",
|
|
36
|
+
".eot": "application/vnd.ms-fontobject",
|
|
37
|
+
// ── Video ─────────────────────────────────────────────────────────────
|
|
38
|
+
".mp4": "video/mp4",
|
|
39
|
+
".webm": "video/webm",
|
|
40
|
+
".ogv": "video/ogg",
|
|
41
|
+
".mov": "video/quicktime",
|
|
42
|
+
".avi": "video/x-msvideo",
|
|
43
|
+
// ── Audio ─────────────────────────────────────────────────────────────
|
|
44
|
+
".mp3": "audio/mpeg",
|
|
45
|
+
".wav": "audio/wav",
|
|
46
|
+
".ogg": "audio/ogg",
|
|
47
|
+
".flac": "audio/flac",
|
|
48
|
+
".aac": "audio/aac",
|
|
49
|
+
// ── Documents / archives ──────────────────────────────────────────────
|
|
50
|
+
".pdf": "application/pdf",
|
|
51
|
+
".zip": "application/zip",
|
|
52
|
+
".gz": "application/gzip",
|
|
53
|
+
".tar": "application/x-tar",
|
|
54
|
+
".wasm": "application/wasm"
|
|
55
|
+
};
|
|
56
|
+
return map[ext.toLowerCase()] ?? "application/octet-stream";
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
escapeHtml,
|
|
60
|
+
getMimeType
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/utils.ts"],
|
|
4
|
+
"sourcesContent": ["/**\r\n * utils.ts \u2014 Shared Utility Functions\r\n *\r\n * Small, dependency-free helpers used across both server and client code.\r\n */\r\n\r\n/**\r\n * Escapes a string for safe inclusion in HTML content or attribute values.\r\n *\r\n * Replaces the five characters that have special meaning in HTML:\r\n * & \u2192 & (must come first to avoid double-escaping)\r\n * < \u2192 <\r\n * > \u2192 >\r\n * \" \u2192 "\r\n * ' \u2192 '\r\n */\r\nexport function escapeHtml(str: string): string {\r\n return str\r\n .replace(/&/g, '&')\r\n .replace(/</g, '<')\r\n .replace(/>/g, '>')\r\n .replace(/\"/g, '"')\r\n .replace(/'/g, ''');\r\n}\r\n\r\n/**\r\n * Returns the correct Content-Type header value for a given file extension.\r\n *\r\n * Covers the full range of file types that are realistic in a public/ directory:\r\n * scripts, styles, images, fonts, media, documents, and data formats.\r\n *\r\n * Falls back to 'application/octet-stream' for unknown extensions so the\r\n * browser downloads rather than tries to render unknown binary content.\r\n */\r\nexport function getMimeType(ext: string): string {\r\n const map: Record<string, string> = {\r\n // \u2500\u2500 Web \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n '.html': 'text/html; charset=utf-8',\r\n '.htm': 'text/html; charset=utf-8',\r\n '.css': 'text/css; charset=utf-8',\r\n '.js': 'application/javascript; charset=utf-8',\r\n '.mjs': 'application/javascript; charset=utf-8',\r\n '.cjs': 'application/javascript; charset=utf-8',\r\n '.map': 'application/json; charset=utf-8',\r\n\r\n // \u2500\u2500 Data \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n '.json': 'application/json; charset=utf-8',\r\n '.xml': 'application/xml; charset=utf-8',\r\n '.txt': 'text/plain; charset=utf-8',\r\n '.csv': 'text/csv; charset=utf-8',\r\n\r\n // \u2500\u2500 Images \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n '.png': 'image/png',\r\n '.jpg': 'image/jpeg',\r\n '.jpeg': 'image/jpeg',\r\n '.gif': 'image/gif',\r\n '.webp': 'image/webp',\r\n '.avif': 'image/avif',\r\n '.svg': 'image/svg+xml',\r\n '.ico': 'image/x-icon',\r\n '.bmp': 'image/bmp',\r\n '.tiff': 'image/tiff',\r\n '.tif': 'image/tiff',\r\n\r\n // \u2500\u2500 Fonts \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n '.woff': 'font/woff',\r\n '.woff2': 'font/woff2',\r\n '.ttf': 'font/ttf',\r\n '.otf': 'font/otf',\r\n '.eot': 'application/vnd.ms-fontobject',\r\n\r\n // \u2500\u2500 Video \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n '.mp4': 'video/mp4',\r\n '.webm': 'video/webm',\r\n '.ogv': 'video/ogg',\r\n '.mov': 'video/quicktime',\r\n '.avi': 'video/x-msvideo',\r\n\r\n // \u2500\u2500 Audio \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n '.mp3': 'audio/mpeg',\r\n '.wav': 'audio/wav',\r\n '.ogg': 'audio/ogg',\r\n '.flac': 'audio/flac',\r\n '.aac': 'audio/aac',\r\n\r\n // \u2500\u2500 Documents / archives \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n '.pdf': 'application/pdf',\r\n '.zip': 'application/zip',\r\n '.gz': 'application/gzip',\r\n '.tar': 'application/x-tar',\r\n '.wasm': 'application/wasm',\r\n };\r\n return map[ext.toLowerCase()] ?? 'application/octet-stream';\r\n}"],
|
|
5
|
+
"mappings": "AAgBO,SAAS,WAAW,KAAqB;AAC9C,SAAO,IACJ,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,QAA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ukejs",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "A minimal, opinionated full-stack React framework on Node.js that server-renders everything and hydrates only interactive parts.",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"nuke": "./bin/index.mjs"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"bin",
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "npx tsx src/builder.ts",
|
|
22
|
+
"dev": "cd playground && node ../bin/index.mjs dev",
|
|
23
|
+
"pack": "npm run build && npm pack",
|
|
24
|
+
"publish": "npm run build && npm publish",
|
|
25
|
+
"test": "npx jest"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/nuke-js/nukejs.git"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"react",
|
|
33
|
+
"nodejs",
|
|
34
|
+
"fullstack",
|
|
35
|
+
"framework",
|
|
36
|
+
"server-side-rendering",
|
|
37
|
+
"ssr",
|
|
38
|
+
"nukejs",
|
|
39
|
+
"nuke"
|
|
40
|
+
],
|
|
41
|
+
"author": "kav3",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"type": "module",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/nuke-js/nukejs/issues"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/nuke-js/nukejs#readme",
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/jest": "^30.0.0",
|
|
50
|
+
"@types/node": "^25.2.3",
|
|
51
|
+
"@types/react-dom": "^19.2.3",
|
|
52
|
+
"jest": "^30.2.0",
|
|
53
|
+
"ts-jest": "^29.4.6",
|
|
54
|
+
"tsx": "^4.21.0",
|
|
55
|
+
"typescript": "^5.9.3"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"esbuild": "^0.27.3",
|
|
59
|
+
"react": "^19.2.4",
|
|
60
|
+
"react-dom": "^19.2.4"
|
|
61
|
+
},
|
|
62
|
+
"workspaces": [
|
|
63
|
+
"playground"
|
|
64
|
+
]
|
|
13
65
|
}
|