Standardize settings file naming and relocate documentation files Fix code quality violations from rsx:check Reorganize user_management directory into logical subdirectories Move Quill Bundle to core and align with Tom Select pattern Simplify Site Settings page to focus on core site information Complete Phase 5: Multi-tenant authentication with login flow and site selection Add route query parameter rule and synchronize filename validation logic Fix critical bug in UpdateNpmCommand causing missing JavaScript stubs Implement filename convention rule and resolve VS Code auto-rename conflict Implement js-sanitizer RPC server to eliminate 900+ Node.js process spawns Implement RPC server architecture for JavaScript parsing WIP: Add RPC server infrastructure for JS parsing (partial implementation) Update jqhtml terminology from destroy to stop, fix datagrid DOM preservation Add JQHTML-CLASS-01 rule and fix redundant class names Improve code quality rules and resolve violations Remove legacy fatal error format in favor of unified 'fatal' error type Filter internal keys from window.rsxapp output Update button styling and comprehensive form/modal documentation Add conditional fly-in animation for modals Fix non-deterministic bundle compilation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
80 lines
1.7 KiB
JavaScript
80 lines
1.7 KiB
JavaScript
let browserslist = require('browserslist')
|
|
let { agents } = require('caniuse-lite/dist/unpacker/agents')
|
|
|
|
let utils = require('./utils')
|
|
|
|
class Browsers {
|
|
constructor(data, requirements, options, browserslistOpts) {
|
|
this.data = data
|
|
this.options = options || {}
|
|
this.browserslistOpts = browserslistOpts || {}
|
|
this.selected = this.parse(requirements)
|
|
}
|
|
|
|
/**
|
|
* Return all prefixes for default browser data
|
|
*/
|
|
static prefixes() {
|
|
if (this.prefixesCache) {
|
|
return this.prefixesCache
|
|
}
|
|
|
|
this.prefixesCache = []
|
|
for (let name in agents) {
|
|
this.prefixesCache.push(`-${agents[name].prefix}-`)
|
|
}
|
|
|
|
this.prefixesCache = utils
|
|
.uniq(this.prefixesCache)
|
|
.sort((a, b) => b.length - a.length)
|
|
|
|
return this.prefixesCache
|
|
}
|
|
|
|
/**
|
|
* Check is value contain any possible prefix
|
|
*/
|
|
static withPrefix(value) {
|
|
if (!this.prefixesRegexp) {
|
|
this.prefixesRegexp = new RegExp(this.prefixes().join('|'))
|
|
}
|
|
|
|
return this.prefixesRegexp.test(value)
|
|
}
|
|
|
|
/**
|
|
* Is browser is selected by requirements
|
|
*/
|
|
isSelected(browser) {
|
|
return this.selected.includes(browser)
|
|
}
|
|
|
|
/**
|
|
* Return browsers selected by requirements
|
|
*/
|
|
parse(requirements) {
|
|
let opts = {}
|
|
for (let i in this.browserslistOpts) {
|
|
opts[i] = this.browserslistOpts[i]
|
|
}
|
|
opts.path = this.options.from
|
|
return browserslist(requirements, opts)
|
|
}
|
|
|
|
/**
|
|
* Return prefix for selected browser
|
|
*/
|
|
prefix(browser) {
|
|
let [name, version] = browser.split(' ')
|
|
let data = this.data[name]
|
|
|
|
let prefix = data.prefix_exceptions && data.prefix_exceptions[version]
|
|
if (!prefix) {
|
|
prefix = data.prefix
|
|
}
|
|
return `-${prefix}-`
|
|
}
|
|
}
|
|
|
|
module.exports = Browsers
|