Implement JQHTML function cache ID system and fix bundle compilation Implement underscore prefix for system tables Fix JS syntax linter to support decorators and grant exception to Task system SPA: Update planning docs and wishlists with remaining features SPA: Document Navigation API abandonment and future enhancements Implement SPA browser integration with History API (Phase 1) Convert contacts view page to SPA action Convert clients pages to SPA actions and document conversion procedure SPA: Merge GET parameters and update documentation Implement SPA route URL generation in JavaScript and PHP Implement SPA bootstrap controller architecture Add SPA routing manual page (rsx:man spa) Add SPA routing documentation to CLAUDE.md Phase 4 Complete: Client-side SPA routing implementation Update get_routes() consumers for unified route structure Complete SPA Phase 3: PHP-side route type detection and is_spa flag Restore unified routes structure and Manifest_Query class Refactor route indexing and add SPA infrastructure Phase 3 Complete: SPA route registration in manifest Implement SPA Phase 2: Extract router code and test decorators Rename Jqhtml_Component to Component and complete SPA foundation setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
66 lines
1.8 KiB
JavaScript
66 lines
1.8 KiB
JavaScript
'use strict';
|
|
// eslint-disable-next-line es/no-object-hasown -- safe
|
|
const has = Object.hasOwn || Function.call.bind({}.hasOwnProperty);
|
|
|
|
const VERSION_PATTERN = /(\d+)(?:\.(\d+))?(?:\.(\d+))?/;
|
|
|
|
class SemVer {
|
|
constructor(input) {
|
|
const match = VERSION_PATTERN.exec(input);
|
|
if (!match) throw new TypeError(`Invalid version: ${ input }`);
|
|
const [, $major, $minor, $patch] = match;
|
|
this.major = +$major;
|
|
this.minor = $minor ? +$minor : 0;
|
|
this.patch = $patch ? +$patch : 0;
|
|
}
|
|
toString() {
|
|
return `${ this.major }.${ this.minor }.${ this.patch }`;
|
|
}
|
|
}
|
|
|
|
function semver(input) {
|
|
return input instanceof SemVer ? input : new SemVer(input);
|
|
}
|
|
|
|
function compare($a, operator, $b) {
|
|
const a = semver($a);
|
|
const b = semver($b);
|
|
for (const component of ['major', 'minor', 'patch']) {
|
|
if (a[component] < b[component]) return operator === '<' || operator === '<=' || operator === '!=';
|
|
if (a[component] > b[component]) return operator === '>' || operator === '>=' || operator === '!=';
|
|
} return operator === '==' || operator === '<=' || operator === '>=';
|
|
}
|
|
|
|
function filterOutStabilizedProposals(modules) {
|
|
const modulesSet = new Set(modules);
|
|
|
|
for (const $module of modulesSet) {
|
|
if ($module.startsWith('esnext.') && modulesSet.has($module.replace(/^esnext\./, 'es.'))) {
|
|
modulesSet.delete($module);
|
|
}
|
|
}
|
|
|
|
return [...modulesSet];
|
|
}
|
|
|
|
function intersection(list, order) {
|
|
const set = list instanceof Set ? list : new Set(list);
|
|
return order.filter(name => set.has(name));
|
|
}
|
|
|
|
function sortObjectByKey(object, fn) {
|
|
return Object.keys(object).sort(fn).reduce((memo, key) => {
|
|
memo[key] = object[key];
|
|
return memo;
|
|
}, {});
|
|
}
|
|
|
|
module.exports = {
|
|
compare,
|
|
filterOutStabilizedProposals,
|
|
has,
|
|
intersection,
|
|
semver,
|
|
sortObjectByKey,
|
|
};
|