@lmjs/core 2.1.0 → 2.1.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/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 two bundles:
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
- // - dist/lumenjs-core-with-plugins.js (+ dist/lumenjs-plugins.css) —
13
- // 2026-09-14: the same file list, but with dom-shim.js swapped for
14
- // real jQuery, plus the plugins confirmed by testing real production
15
- // content (console.roxyon.com) end-to-end: Select2, Flickity,
16
- // bootstrap-colorpicker, bootstrap-datetimepicker. See PROVENANCE.md
17
- // for exactly how each one was identified (bea.js is minified with no
18
- // identifying strings left matched by API/option shape instead:
19
- // `format: 'rgba'` for bootstrap-colorpicker, the DPGlobal/startView/
20
- // minView/maxView/todayBtn signature for bootstrap-datetimepicker) and
21
- // why these four and not the wider list an earlier version of this
22
- // comment speculated (jQuery UI, tag-editor, jquery.lazy, ...) none
23
- // of those are actually called anywhere in any real project checked
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 — and never to readModule() (real third-party
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
- // (shim vs. real+plugins) sits underneath it. Takes the already-built
92
- // jQuery layer as a string and appends everything else after it.
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) `--with-plugins` set,
2
- // factored out of build/bundle.js's buildCoreWithPlugins()/buildPluginsCss()
3
- // (2026-09-16) into one data structure both the existing prebuilt monolith
4
- // AND a future per-project selective bundle (packages/cli) can consume.
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 today's real,
8
- // already-shipped, already-tested load order transcribed mechanically
9
- // from build/bundle.js's buildCoreWithPlugins(), not reconstructed from
10
- // memory. A topo sort over `after` edges could legally reorder two
11
- // independent no-dependency entries (e.g. jquery.easing vs jquery.numeric
12
- // no real dependency between them, but SOME specific order exists in the
13
- // real, shipped bundle), which would change dist/lumenjs-core-with-plugins.js's
14
- // bytes for no functional reason. `validateOrder()` below instead turns the
15
- // ordering knowledge that used to live only in code comments into an
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, for the
23
- // future per-project selective bundle — see PROVENANCE.md).
24
- // npm — one path or an array of paths, relative to node_modules,
25
- // exactly matching the readModule() calls this replaces.
26
- // css — one path or an array of paths (relative to node_modules)
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), not by this file's own
86
- // buildCoreWithPlugins() that build is plain string
87
- // concatenation, never triggers select2's UMD wrapper's CommonJS
88
- // branch at all, so this quirk never applies to it. Select2's own
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lmjs/core",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "LumenJS reactive core runtime — the reactive engine, HTML/JS AST compiler, realtime socket client, and delegated event listeners powering LumenJS applications.",
5
5
  "files": [
6
6
  "dist/",
package/src/_re.js CHANGED
@@ -1525,12 +1525,11 @@ class _lm {
1525
1525
  // minified code) — [sl]/[color]/[time]/[date]/[datetime] elements
1526
1526
  // become their respective widgets on mount, no explicit script
1527
1527
  // call needed, matching V1's documented behavior (lumenjs-
1528
- // spec.md §5.6/§6.7). Built into core directly rather than living
1529
- // only in the --with-plugins bundle (explicit choice, 2026-09-16)
1530
- // — autoInitPlugins() itself guards every call on the matching
1531
- // $.fn.* method actually existing, so a plain (no --with-plugins)
1532
- // project's dom-shim-based bundle silently no-ops instead of
1533
- // throwing when it encounters one of these attributes.
1528
+ // spec.md §5.6/§6.7). Built into core directly, always available
1529
+ // (explicit choice, 2026-09-16) — autoInitPlugins() itself guards
1530
+ // every call on the matching $.fn.* method actually existing, so a
1531
+ // plain project with no plugins selected silently no-ops instead
1532
+ // of throwing when it encounters one of these attributes.
1534
1533
  autoInitPlugins(_el, attrs);
1535
1534
 
1536
1535
  return _el;
@@ -2352,12 +2351,11 @@ async function fireRenderHook(cx, n, containerEl, extra) {
2352
2351
  // (SBEACDN/s.beacdn.com/beajs/core.js:2846/3834, confirmed against the
2353
2352
  // real V1 build root this session already located, not reverse-engineered
2354
2353
  // from minified code). Called from createEl() on every element's mount.
2355
- // Deliberately built into packages/core's own engine rather than kept
2356
- // inside the --with-plugins bundle only — every call below is guarded on
2357
- // the matching $.fn.* method actually existing, so a plain project (no
2358
- // --with-plugins, dom-shim-based, none of these libraries loaded) safely
2359
- // no-ops instead of throwing when a view happens to use one of these
2360
- // attributes.
2354
+ // Deliberately built into packages/core's own engine, always available
2355
+ // every call below is guarded on the matching $.fn.* method actually
2356
+ // existing, so a plain project (dom-shim-based, none of these libraries
2357
+ // loaded) safely no-ops instead of throwing when a view happens to use one
2358
+ // of these attributes.
2361
2359
  function autoInitPlugins(el, attrs) {
2362
2360
  if (!attrs) return;
2363
2361
  try {
@@ -2468,9 +2466,9 @@ var _dbcrsTime = 250;
2468
2466
 
2469
2467
  // Real V1 source, ported as-is (SBEACDN core.js:3834-3891) — bootstrap-
2470
2468
  // datetimepicker option builder + optional start/end date-linking. Not
2471
- // documented in lumenjs-spec.md (see PROVENANCE.md's --with-plugins
2472
- // section); this exact option shape was confirmed directly against V1's
2473
- // real source once it was located this session, not reverse-engineered.
2469
+ // documented in lumenjs-spec.md (see PROVENANCE.md's plugins section);
2470
+ // this exact option shape was confirmed directly against V1's real source
2471
+ // once it was located this session, not reverse-engineered.
2474
2472
  function dtp(el, t) {
2475
2473
  el.removeAttr(t);
2476
2474
  let opts = {