bitwrench 2.0.16 → 2.0.18
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/README.md +127 -38
- package/dist/bitwrench-bccl.cjs.js +13 -9
- package/dist/bitwrench-bccl.cjs.min.js +2 -2
- package/dist/bitwrench-bccl.esm.js +13 -9
- package/dist/bitwrench-bccl.esm.min.js +2 -2
- package/dist/bitwrench-bccl.umd.js +13 -9
- 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 +1438 -920
- package/dist/bitwrench-lean.cjs.min.js +20 -20
- package/dist/bitwrench-lean.es5.js +1518 -1105
- package/dist/bitwrench-lean.es5.min.js +18 -18
- package/dist/bitwrench-lean.esm.js +1437 -920
- package/dist/bitwrench-lean.esm.min.js +20 -20
- package/dist/bitwrench-lean.umd.js +1438 -920
- package/dist/bitwrench-lean.umd.min.js +20 -20
- package/dist/bitwrench-util-css.cjs.js +236 -0
- package/dist/bitwrench-util-css.cjs.min.js +22 -0
- package/dist/bitwrench-util-css.es5.js +414 -0
- package/dist/bitwrench-util-css.es5.min.js +21 -0
- package/dist/bitwrench-util-css.esm.js +230 -0
- package/dist/bitwrench-util-css.esm.min.js +21 -0
- package/dist/bitwrench-util-css.umd.js +242 -0
- package/dist/bitwrench-util-css.umd.min.js +21 -0
- package/dist/bitwrench.cjs.js +1450 -928
- package/dist/bitwrench.cjs.min.js +21 -21
- package/dist/bitwrench.css +456 -132
- package/dist/bitwrench.es5.js +1563 -1140
- package/dist/bitwrench.es5.min.js +19 -19
- package/dist/bitwrench.esm.js +1450 -929
- package/dist/bitwrench.esm.min.js +21 -21
- package/dist/bitwrench.min.css +1 -1
- package/dist/bitwrench.umd.js +1450 -928
- package/dist/bitwrench.umd.min.js +21 -21
- package/dist/builds.json +178 -90
- package/dist/bwserve.cjs.js +528 -68
- package/dist/bwserve.esm.js +527 -69
- package/dist/sri.json +44 -36
- package/package.json +5 -2
- package/readme.html +136 -49
- package/src/bitwrench-bccl.js +12 -8
- package/src/bitwrench-color-utils.js +31 -9
- package/src/bitwrench-esm-entry.js +11 -0
- package/src/bitwrench-styles.js +439 -232
- package/src/bitwrench-util-css.js +229 -0
- package/src/bitwrench.js +979 -630
- package/src/bwserve/attach.js +57 -0
- package/src/bwserve/bwclient.js +141 -0
- package/src/bwserve/bwshell.js +102 -0
- package/src/bwserve/client.js +151 -1
- package/src/bwserve/index.js +139 -29
- package/src/cli/attach.js +555 -0
- package/src/cli/convert.js +2 -5
- package/src/cli/index.js +7 -0
- package/src/cli/inject.js +1 -1
- package/src/cli/layout-default.js +47 -32
- package/src/cli/serve.js +6 -2
- package/src/generate-css.js +11 -4
- package/src/vendor/html2canvas.min.js +20 -0
- package/src/version.js +3 -3
- package/src/bwserve/shell.js +0 -103
|
@@ -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/cli/serve.js
CHANGED
|
@@ -29,6 +29,7 @@ Options:
|
|
|
29
29
|
--stdin Read protocol messages from stdin (newline-delimited JSON)
|
|
30
30
|
-t, --theme <name> Theme preset or hex colors ("#pri,#sec")
|
|
31
31
|
--title <string> Page title (default: "bwcli serve")
|
|
32
|
+
--allow-exec Enable exec messages (runs JS in browser, use for dev only)
|
|
32
33
|
--open Open browser on start
|
|
33
34
|
-v, --verbose Verbose output
|
|
34
35
|
-h, --help Print this help
|
|
@@ -148,6 +149,7 @@ export function runServe(argv) {
|
|
|
148
149
|
stdin: { type: 'boolean' },
|
|
149
150
|
theme: { type: 'string', short: 't' },
|
|
150
151
|
title: { type: 'string' },
|
|
152
|
+
'allow-exec': { type: 'boolean' },
|
|
151
153
|
open: { type: 'boolean' },
|
|
152
154
|
verbose: { type: 'boolean', short: 'v' },
|
|
153
155
|
help: { type: 'boolean', short: 'h' }
|
|
@@ -193,7 +195,8 @@ export function runServe(argv) {
|
|
|
193
195
|
theme: theme,
|
|
194
196
|
title: title,
|
|
195
197
|
verbose: verbose,
|
|
196
|
-
open: !!values.open
|
|
198
|
+
open: !!values.open,
|
|
199
|
+
allowExec: !!values['allow-exec']
|
|
197
200
|
});
|
|
198
201
|
}).catch(function(err) {
|
|
199
202
|
console.error('Failed to load bwserve: ' + err.message);
|
|
@@ -209,7 +212,8 @@ function startServer(bwserve, opts) {
|
|
|
209
212
|
port: opts.webPort,
|
|
210
213
|
title: opts.title,
|
|
211
214
|
static: opts.dir,
|
|
212
|
-
theme: opts.theme
|
|
215
|
+
theme: opts.theme,
|
|
216
|
+
allowExec: opts.allowExec
|
|
213
217
|
});
|
|
214
218
|
|
|
215
219
|
// Register a passthrough page handler — just keeps clients alive
|
package/src/generate-css.js
CHANGED
|
@@ -8,16 +8,23 @@ import { getAllStyles, getStructuralStyles, generateThemedCSS,
|
|
|
8
8
|
import { derivePalette } from './bitwrench-color-utils.js';
|
|
9
9
|
import fs from 'fs';
|
|
10
10
|
import path from 'path';
|
|
11
|
+
import { createRequire } from 'module';
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const pkg = require('../package.json');
|
|
11
14
|
|
|
12
15
|
// Convert styles object to CSS string
|
|
13
16
|
function stylesToCSS(styles) {
|
|
14
17
|
let css = `/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* Generated from bitwrench-styles.js
|
|
18
|
+
* bitwrench.css v${pkg.version} — AUTO-GENERATED, DO NOT EDIT
|
|
19
|
+
*
|
|
20
|
+
* Generated by src/generate-css.js from bitwrench-styles.js
|
|
21
|
+
* This is a static snapshot of what bw.loadStyles() produces
|
|
22
|
+
* at runtime. Use one or the other, not both.
|
|
23
|
+
*
|
|
24
|
+
* To regenerate: npm run build:css
|
|
25
|
+
* ${pkg.homepage}
|
|
18
26
|
*/
|
|
19
27
|
|
|
20
|
-
/* Base styles with .bw namespace */
|
|
21
28
|
`;
|
|
22
29
|
|
|
23
30
|
// Process each style rule
|