bitwrench 2.0.16 → 2.0.17
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/dist/bitwrench-bccl.cjs.js +6 -2
- package/dist/bitwrench-bccl.cjs.min.js +3 -3
- package/dist/bitwrench-bccl.esm.js +6 -2
- package/dist/bitwrench-bccl.esm.min.js +3 -3
- package/dist/bitwrench-bccl.umd.js +6 -2
- package/dist/bitwrench-bccl.umd.min.js +2 -2
- package/dist/bitwrench-code-edit.cjs.js +1 -1
- package/dist/bitwrench-code-edit.cjs.min.js +1 -1
- package/dist/bitwrench-code-edit.es5.js +1 -1
- package/dist/bitwrench-code-edit.es5.min.js +1 -1
- package/dist/bitwrench-code-edit.esm.js +1 -1
- package/dist/bitwrench-code-edit.esm.min.js +1 -1
- package/dist/bitwrench-code-edit.umd.js +1 -1
- package/dist/bitwrench-code-edit.umd.min.js +1 -1
- package/dist/bitwrench-lean.cjs.js +506 -154
- package/dist/bitwrench-lean.cjs.min.js +7 -7
- package/dist/bitwrench-lean.es5.js +517 -155
- package/dist/bitwrench-lean.es5.min.js +5 -5
- package/dist/bitwrench-lean.esm.js +505 -154
- package/dist/bitwrench-lean.esm.min.js +6 -6
- package/dist/bitwrench-lean.umd.js +506 -154
- package/dist/bitwrench-lean.umd.min.js +7 -7
- package/dist/bitwrench.cjs.js +511 -155
- package/dist/bitwrench.cjs.min.js +8 -8
- package/dist/bitwrench.es5.js +525 -156
- package/dist/bitwrench.es5.min.js +6 -6
- package/dist/bitwrench.esm.js +510 -155
- package/dist/bitwrench.esm.min.js +8 -8
- package/dist/bitwrench.umd.js +511 -155
- package/dist/bitwrench.umd.min.js +8 -8
- package/dist/builds.json +82 -82
- package/dist/bwserve.cjs.js +16 -2
- package/dist/bwserve.esm.js +16 -2
- package/dist/sri.json +34 -34
- package/package.json +4 -2
- package/readme.html +1 -1
- package/src/bitwrench-bccl.js +5 -1
- package/src/bitwrench.js +502 -151
- package/src/bwserve/index.js +12 -1
- package/src/bwserve/shell.js +3 -0
- package/src/cli/layout-default.js +47 -32
- package/src/version.js +3 -3
package/src/bwserve/index.js
CHANGED
|
@@ -26,7 +26,16 @@ import { createServer } from 'http';
|
|
|
26
26
|
import { readFileSync, existsSync, statSync } from 'fs';
|
|
27
27
|
|
|
28
28
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
29
|
+
|
|
30
|
+
// Resolve dist/ — try source layout (src/bwserve/), then npm install layout,
|
|
31
|
+
// then dist/ itself (when running from dist/bwserve.esm.js)
|
|
29
32
|
var DIST_DIR = resolve(__dirname, '..', '..', 'dist');
|
|
33
|
+
if (!existsSync(DIST_DIR)) {
|
|
34
|
+
DIST_DIR = resolve(__dirname, '..', 'dist');
|
|
35
|
+
}
|
|
36
|
+
if (!existsSync(DIST_DIR)) {
|
|
37
|
+
DIST_DIR = __dirname;
|
|
38
|
+
}
|
|
30
39
|
|
|
31
40
|
// MIME type lookup for static file serving
|
|
32
41
|
var MIME_TYPES = {
|
|
@@ -73,6 +82,7 @@ class BwServeApp {
|
|
|
73
82
|
this.staticDir = opts.static || null;
|
|
74
83
|
this.injectBitwrench = opts.injectBitwrench !== false;
|
|
75
84
|
this.theme = opts.theme || null;
|
|
85
|
+
this.allowExec = opts.allowExec || false;
|
|
76
86
|
this.keepAliveInterval = opts.keepAliveInterval || 15000;
|
|
77
87
|
this._pages = new Map();
|
|
78
88
|
this._clients = new Map();
|
|
@@ -219,7 +229,8 @@ class BwServeApp {
|
|
|
219
229
|
clientId: clientId2,
|
|
220
230
|
title: this.title,
|
|
221
231
|
theme: this.theme,
|
|
222
|
-
injectBitwrench: this.injectBitwrench
|
|
232
|
+
injectBitwrench: this.injectBitwrench,
|
|
233
|
+
allowExec: this.allowExec
|
|
223
234
|
});
|
|
224
235
|
// Store the page path for this client so SSE knows which handler to call
|
|
225
236
|
this._clients.set(clientId2, { pagePath: path, client: null });
|
package/src/bwserve/shell.js
CHANGED
|
@@ -64,6 +64,9 @@ export function generateShell(opts) {
|
|
|
64
64
|
script.push(' var clientId = ' + JSON.stringify(clientId) + ';');
|
|
65
65
|
script.push(' var conn = bw.clientConnect("/__bw/events/" + clientId, {');
|
|
66
66
|
script.push(' actionUrl: "/__bw/action/" + clientId,');
|
|
67
|
+
if (opts.allowExec) {
|
|
68
|
+
script.push(' allowExec: true,');
|
|
69
|
+
}
|
|
67
70
|
script.push(' onStatus: function(s) {');
|
|
68
71
|
script.push(' if (typeof console !== "undefined") console.log("[bwserve] " + s);');
|
|
69
72
|
script.push(' }');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bitwrench CLI - Default page layout
|
|
3
|
-
* Wraps converted content in a complete HTML document
|
|
3
|
+
* Wraps converted content in a complete HTML document.
|
|
4
|
+
* Delegates to bw.htmlPage() for document structure.
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
import bw from '../bitwrench.js';
|
|
@@ -77,7 +78,11 @@ const BASE_PAGE_CSS = `
|
|
|
77
78
|
`;
|
|
78
79
|
|
|
79
80
|
/**
|
|
80
|
-
* Build a complete HTML page from content and options
|
|
81
|
+
* Build a complete HTML page from content and options.
|
|
82
|
+
* Delegates to bw.htmlPage() for document structure, adding CLI-specific
|
|
83
|
+
* concerns: .bw_cli_page wrapper, generator meta tag, highlight.js, and
|
|
84
|
+
* pre-resolved injection strings from inject.js.
|
|
85
|
+
*
|
|
81
86
|
* @param {Object} opts
|
|
82
87
|
* @param {string} opts.title - Page title
|
|
83
88
|
* @param {string} opts.bodyHTML - Rendered HTML content for the body
|
|
@@ -99,44 +104,54 @@ export function makePageLayout(opts) {
|
|
|
99
104
|
highlight = false
|
|
100
105
|
} = opts;
|
|
101
106
|
|
|
102
|
-
const
|
|
103
|
-
const version = bw.version;
|
|
107
|
+
const version = bw.getVersion().version;
|
|
104
108
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
109
|
+
// Build extra <head> elements: generator meta, injection script, highlight.js CSS
|
|
110
|
+
const headElements = [];
|
|
111
|
+
|
|
112
|
+
// Generator meta tag (CLI-specific)
|
|
113
|
+
headElements.push({
|
|
114
|
+
t: 'meta', a: { name: 'generator', content: 'bitwrench v' + version }
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// Injection script from inject.js (already pre-built HTML string)
|
|
118
|
+
if (headInjection) {
|
|
119
|
+
headElements.push(bw.raw(headInjection));
|
|
112
120
|
}
|
|
113
121
|
|
|
114
|
-
|
|
115
|
-
let highlightBodyEnd = '';
|
|
122
|
+
// Highlight.js CSS
|
|
116
123
|
if (highlight) {
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
headElements.push({
|
|
125
|
+
t: 'link', a: {
|
|
126
|
+
rel: 'stylesheet',
|
|
127
|
+
href: 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11/build/styles/github.min.css'
|
|
128
|
+
}
|
|
129
|
+
});
|
|
119
130
|
}
|
|
120
131
|
|
|
132
|
+
// Wrap body content in .bw_cli_page div (CLI-specific)
|
|
133
|
+
const wrappedBody = '<div class="bw_cli_page">\n' + bodyHTML + '\n</div>';
|
|
134
|
+
|
|
135
|
+
// Build body-end injection (highlight.js init)
|
|
136
|
+
let fullBodyEnd = bodyEndInjection || '';
|
|
137
|
+
if (highlight) {
|
|
138
|
+
fullBodyEnd += '<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11/build/highlight.min.js"></script>\n<script>hljs.highlightAll();</script>';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Combine all CSS
|
|
121
142
|
const allCSS = BASE_PAGE_CSS + (css ? '\n' + css : '');
|
|
122
143
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
<div class="bw_cli_page">
|
|
135
|
-
${bodyHTML}
|
|
136
|
-
</div>
|
|
137
|
-
${bodyEndInjection}${highlightBodyEnd}
|
|
138
|
-
</body>
|
|
139
|
-
</html>`;
|
|
144
|
+
// Use bw.htmlPage() with runtime:'none' since CLI handles injection itself
|
|
145
|
+
var page = bw.htmlPage({
|
|
146
|
+
title: title,
|
|
147
|
+
body: wrappedBody + (fullBodyEnd ? '\n' + fullBodyEnd : ''),
|
|
148
|
+
css: allCSS,
|
|
149
|
+
head: headElements,
|
|
150
|
+
favicon: favicon,
|
|
151
|
+
runtime: 'none'
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
return page;
|
|
140
155
|
}
|
|
141
156
|
|
|
142
157
|
export { BASE_PAGE_CSS };
|
package/src/version.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* DO NOT EDIT DIRECTLY - Use npm run generate-version
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export const VERSION = '2.0.
|
|
6
|
+
export const VERSION = '2.0.17';
|
|
7
7
|
export const VERSION_INFO = {
|
|
8
|
-
version: '2.0.
|
|
8
|
+
version: '2.0.17',
|
|
9
9
|
name: 'bitwrench',
|
|
10
10
|
description: 'A library for javascript UI functions.',
|
|
11
11
|
license: 'BSD-2-Clause',
|
|
12
12
|
homepage: 'https://deftio.github.com/bitwrench/pages',
|
|
13
13
|
repository: 'git+https://github.com/deftio/bitwrench.git',
|
|
14
14
|
author: 'manu a. chatterjee <deftio@deftio.com> (https://deftio.com/)',
|
|
15
|
-
buildDate: '2026-03-
|
|
15
|
+
buildDate: '2026-03-13T23:15:10.823Z'
|
|
16
16
|
};
|