@lmjs/core 2.1.0 → 2.1.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/build/bundle.js +18 -101
- package/build/plugins-registry.js +28 -26
- package/dist/lumenjs-core.js +3 -3
- package/package.json +1 -1
- package/src/_re.js +37 -18
- package/src/ws.js +26 -11
- package/dist/lumenjs-core-with-plugins.js +0 -59258
- package/dist/lumenjs-plugins.css +0 -2822
package/build/bundle.js
CHANGED
|
@@ -3,37 +3,31 @@
|
|
|
3
3
|
// working-session decision (2026-09-13) to keep V2 fully separate rather
|
|
4
4
|
// than editing the live PHP CDN pipeline.
|
|
5
5
|
//
|
|
6
|
-
// Produces
|
|
6
|
+
// Produces one bundle:
|
|
7
7
|
// - dist/lumenjs-core.js — dom-shim.js (a minimal jQuery-compatible
|
|
8
8
|
// layer) + the css/up workers + walk.js + _re.js + vendor/
|
|
9
9
|
// reconnecting-websocket.js + index-bootstrap.js + ws.js + lstnrs.js.
|
|
10
10
|
// No real jQuery, no plugins. This is the default every LumenJS V2
|
|
11
11
|
// page gets.
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
// (10 real sites), and drag/sort (§6.4 of the spec) turned out to be
|
|
25
|
-
// custom-implemented, not jQuery-UI-based, so no jQuery UI dependency
|
|
26
|
-
// is needed at all.
|
|
12
|
+
//
|
|
13
|
+
// 2026-09-19: this file used to also produce a second, monolithic
|
|
14
|
+
// dist/lumenjs-core-with-plugins.js (+ dist/lumenjs-plugins.css) — real
|
|
15
|
+
// jQuery + all 18 registry libraries baked into one file. Removed: proven
|
|
16
|
+
// functionally redundant with packages/cli's per-project selective plugin
|
|
17
|
+
// bundling (a project lists exact registry keys in its own package.json
|
|
18
|
+
// dependencies) — both ultimately produce [some real-jQuery-based plugin
|
|
19
|
+
// set] + the exact same buildCommonTail() engine code below; the only real
|
|
20
|
+
// difference was one combined file vs. two. See PROVENANCE.md and
|
|
21
|
+
// build/plugins-registry.js (kept — still the shared source of truth the
|
|
22
|
+
// selective mechanism in packages/cli reads from) for the full per-library
|
|
23
|
+
// sourcing trail, which is still accurate and still load-bearing.
|
|
27
24
|
|
|
28
25
|
const fs = require('fs');
|
|
29
26
|
const path = require('path');
|
|
30
|
-
const less = require('less');
|
|
31
27
|
const esbuild = require('esbuild');
|
|
32
|
-
const pluginsRegistry = require('./plugins-registry.js');
|
|
33
28
|
|
|
34
29
|
const SRC = path.join(__dirname, '..', 'src');
|
|
35
30
|
const VENDOR = path.join(__dirname, '..', 'vendor');
|
|
36
|
-
const NODE_MODULES = path.join(__dirname, '..', 'node_modules');
|
|
37
31
|
const OUT_DIR = path.join(__dirname, '..', 'dist');
|
|
38
32
|
|
|
39
33
|
// 2026-09-16: this codebase's own source comments are deliberately
|
|
@@ -64,8 +58,7 @@ const OUT_DIR = path.join(__dirname, '..', 'dist');
|
|
|
64
58
|
// astring.js is already a minified third-party build with nothing to
|
|
65
59
|
// gain from re-stripping. Applied explicitly at each call site below
|
|
66
60
|
// instead, only for files that really are directly-concatenated,
|
|
67
|
-
// standalone top-level JS
|
|
68
|
-
// npm packages), whose license headers must be preserved as-is.
|
|
61
|
+
// standalone top-level JS.
|
|
69
62
|
function stripComments(src) {
|
|
70
63
|
return esbuild.transformSync(src, {
|
|
71
64
|
loader: 'js',
|
|
@@ -83,13 +76,11 @@ function readVendor(relPath) {
|
|
|
83
76
|
return fs.readFileSync(path.join(VENDOR, relPath), 'utf8');
|
|
84
77
|
}
|
|
85
78
|
|
|
86
|
-
function readModule(relPath) {
|
|
87
|
-
return fs.readFileSync(path.join(NODE_MODULES, relPath), 'utf8');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
79
|
// The part of the bundle that's identical regardless of which jQuery layer
|
|
91
|
-
//
|
|
92
|
-
//
|
|
80
|
+
// sits underneath it — dom-shim.js here; a project's own selective plugin
|
|
81
|
+
// bundle (packages/cli) can layer real jQuery on top of this same output
|
|
82
|
+
// as a separate, later <script>. Takes the already-built jQuery layer as a
|
|
83
|
+
// string and appends everything else after it.
|
|
93
84
|
function buildCommonTail() {
|
|
94
85
|
const parts = [];
|
|
95
86
|
|
|
@@ -166,69 +157,6 @@ function buildCore() {
|
|
|
166
157
|
return parts.join('\n');
|
|
167
158
|
}
|
|
168
159
|
|
|
169
|
-
// 2026-09-16: registry-ified. Every library's npm path(s), ordering
|
|
170
|
-
// constraint, and build-time patch used to live inline here — now in
|
|
171
|
-
// build/plugins-registry.js, the single source of truth both this
|
|
172
|
-
// monolithic build AND a future per-project selective bundle (packages/cli)
|
|
173
|
-
// consume. This refactor is a pure mechanical transcription with no
|
|
174
|
-
// intended behavior change — see plugins-registry.js's own header for the
|
|
175
|
-
// exact reasoning (why a plain ordered array, not a topological sort) and
|
|
176
|
-
// PROVENANCE.md for the full per-library sourcing trail (why each library
|
|
177
|
-
// was picked, exact version matches, etc. — that detail lives there, not
|
|
178
|
-
// duplicated per-entry here anymore).
|
|
179
|
-
function buildCoreWithPlugins() {
|
|
180
|
-
pluginsRegistry.validateOrder(pluginsRegistry);
|
|
181
|
-
const parts = [];
|
|
182
|
-
parts.push('/* LumenJS V2 core (with real jQuery + plugins) — generated by packages/core/build/bundle.js, do not edit directly */');
|
|
183
|
-
for (const entry of pluginsRegistry) {
|
|
184
|
-
for (const npmPath of [].concat(entry.npm || [])) {
|
|
185
|
-
let src = readModule(npmPath);
|
|
186
|
-
if (entry.patch) src = entry.patch(src);
|
|
187
|
-
parts.push(src);
|
|
188
|
-
}
|
|
189
|
-
if (entry.code) parts.push(entry.code);
|
|
190
|
-
}
|
|
191
|
-
parts.push(buildCommonTail());
|
|
192
|
-
// 2026-09-15, real bug: joining with a bare '\n' let a missing trailing
|
|
193
|
-
// semicolon in one vendored file merge into the next one via automatic
|
|
194
|
-
// semicolon insertion — bootstrap-datetimepicker's source ends with
|
|
195
|
-
// `})(window.jQuery)` (no `;`), and jQuery UI's starts with
|
|
196
|
-
// `( function( factory ) {`, so ASI read the two as ONE continuous
|
|
197
|
-
// call chain (`(...)(...)(...)...`) instead of two separate IIFEs —
|
|
198
|
-
// exactly matching the resulting error, "(intermediate value)(...) is
|
|
199
|
-
// not a function". This is a real risk for ANY two files in this list,
|
|
200
|
-
// not just this one pair, since none of the ~18 vendored sources here
|
|
201
|
-
// are guaranteed to end with a semicolon. `;\n` as the join separator
|
|
202
|
-
// closes the whole class of bug at once — an extra leading `;` is
|
|
203
|
-
// always a harmless no-op statement in JS.
|
|
204
|
-
return parts.join(';\n');
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
async function buildPluginsCss() {
|
|
208
|
-
const parts = [];
|
|
209
|
-
parts.push('/* LumenJS V2 plugins CSS — generated by packages/core/build/bundle.js, do not edit directly */');
|
|
210
|
-
for (const entry of pluginsRegistry) {
|
|
211
|
-
if (entry.css) {
|
|
212
|
-
for (const cssPath of [].concat(entry.css)) {
|
|
213
|
-
let src = readModule(cssPath);
|
|
214
|
-
if (entry.cssPatch) src = entry.cssPatch(src);
|
|
215
|
-
parts.push(src);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
if (entry.lessCss) {
|
|
219
|
-
// bootstrap-datetimepicker ships only LESS, no compiled CSS at
|
|
220
|
-
// all — compile it here rather than hand-vendoring a pre-built copy.
|
|
221
|
-
const lessSrc = readModule(entry.lessCss);
|
|
222
|
-
const lessOut = await less.render(lessSrc, {
|
|
223
|
-
filename: path.join(NODE_MODULES, entry.lessCss),
|
|
224
|
-
paths: [path.join(VENDOR, 'bootstrap2-less-stubs')],
|
|
225
|
-
});
|
|
226
|
-
parts.push(lessOut.css);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
return parts.join('\n');
|
|
230
|
-
}
|
|
231
|
-
|
|
232
160
|
async function main() {
|
|
233
161
|
if (!fs.existsSync(OUT_DIR)) fs.mkdirSync(OUT_DIR, { recursive: true });
|
|
234
162
|
|
|
@@ -237,17 +165,6 @@ async function main() {
|
|
|
237
165
|
fs.writeFileSync(outPath, core);
|
|
238
166
|
console.log('Wrote ' + outPath + ' (' + core.length + ' bytes)');
|
|
239
167
|
checkSyntax(core, outPath);
|
|
240
|
-
|
|
241
|
-
const withPlugins = buildCoreWithPlugins();
|
|
242
|
-
const withPluginsPath = path.join(OUT_DIR, 'lumenjs-core-with-plugins.js');
|
|
243
|
-
fs.writeFileSync(withPluginsPath, withPlugins);
|
|
244
|
-
console.log('Wrote ' + withPluginsPath + ' (' + withPlugins.length + ' bytes)');
|
|
245
|
-
checkSyntax(withPlugins, withPluginsPath);
|
|
246
|
-
|
|
247
|
-
const pluginsCss = await buildPluginsCss();
|
|
248
|
-
const pluginsCssPath = path.join(OUT_DIR, 'lumenjs-plugins.css');
|
|
249
|
-
fs.writeFileSync(pluginsCssPath, pluginsCss);
|
|
250
|
-
console.log('Wrote ' + pluginsCssPath + ' (' + pluginsCss.length + ' bytes)');
|
|
251
168
|
}
|
|
252
169
|
|
|
253
170
|
function checkSyntax(code, outPath) {
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
// plugins-registry.js — the 18-library (+jQuery)
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
1
|
+
// plugins-registry.js — the 18-library (+jQuery) set available for
|
|
2
|
+
// per-project selective plugin bundling (packages/cli/lib/
|
|
3
|
+
// plugins-esbuild-plugin.js), the single source of truth for each
|
|
4
|
+
// library's npm path(s), build-time patch, and `after`-ordering
|
|
5
|
+
// constraint. (2026-09-19: originally factored out of build/bundle.js's
|
|
6
|
+
// now-removed buildCoreWithPlugins()/buildPluginsCss() — those built one
|
|
7
|
+
// monolithic bundle with all 18 always included; removed as functionally
|
|
8
|
+
// redundant with selecting all 18 via the selective mechanism. This
|
|
9
|
+
// registry itself is unaffected — still the shared source of truth, just
|
|
10
|
+
// with one consumer instead of two.)
|
|
5
11
|
//
|
|
6
12
|
// Deliberately a plain ORDERED ARRAY, not something that computes an order
|
|
7
|
-
// via topological sort: this array's declaration order IS
|
|
8
|
-
// already-
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// enforced invariant: it throws if any entry's `after` key doesn't already
|
|
17
|
-
// appear earlier in the array, catching a broken reorder immediately
|
|
18
|
-
// instead of letting it silently ship.
|
|
13
|
+
// via topological sort: this array's declaration order IS the real,
|
|
14
|
+
// already-tested load order. A topo sort over `after` edges could legally
|
|
15
|
+
// reorder two independent no-dependency entries (e.g. jquery.easing vs
|
|
16
|
+
// jquery.numeric — no real dependency between them, but SOME specific
|
|
17
|
+
// order was already tested) for no functional reason. `validateOrder()`
|
|
18
|
+
// below instead turns the ordering knowledge that used to live only in
|
|
19
|
+
// code comments into an enforced invariant: it throws if any entry's
|
|
20
|
+
// `after` key doesn't already appear earlier in the array, catching a
|
|
21
|
+
// broken reorder immediately instead of letting it silently ship.
|
|
19
22
|
//
|
|
20
23
|
// Each entry:
|
|
21
24
|
// key — the real npm package name (also what a project's own
|
|
22
|
-
// package.json dependency list is matched against
|
|
23
|
-
//
|
|
24
|
-
// npm — one path or an array of paths, relative to node_modules
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
// for buildPluginsCss(), if this library ships compiled CSS.
|
|
25
|
+
// package.json dependency list is matched against — see
|
|
26
|
+
// PROVENANCE.md).
|
|
27
|
+
// npm — one path or an array of paths, relative to node_modules.
|
|
28
|
+
// css — one path or an array of paths (relative to node_modules),
|
|
29
|
+
// if this library ships compiled CSS.
|
|
28
30
|
// lessCss — a LESS source path to compile via the `less` package,
|
|
29
31
|
// for the one library (bootstrap-datetimepicker) that ships
|
|
30
32
|
// only LESS, no compiled CSS.
|
|
@@ -82,10 +84,10 @@ const registry = [
|
|
|
82
84
|
css: 'select2/dist/css/select2.css',
|
|
83
85
|
after: ['jquery'],
|
|
84
86
|
// Only consumed by packages/cli's per-project selective esbuild
|
|
85
|
-
// bundle (plugins-esbuild-plugin.js)
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
//
|
|
87
|
+
// bundle (plugins-esbuild-plugin.js) — plain string concatenation
|
|
88
|
+
// (how every other entry here gets combined) never triggers
|
|
89
|
+
// select2's UMD wrapper's CommonJS branch at all, so this quirk
|
|
90
|
+
// only matters for esbuild-based resolution. Select2's own
|
|
89
91
|
// UMD wrapper (dist/js/select2.js) is unusual among these 18
|
|
90
92
|
// libraries: its CommonJS branch exports a FACTORY FUNCTION
|
|
91
93
|
// (`module.exports = function (root, jQuery) {...}`) rather than
|