Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
'use strict';
|
|
// Try to get file ignorer from '.stylelintignore'
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const { default: ignore } = require('ignore');
|
|
|
|
const isPathNotFoundError = require('./isPathNotFoundError');
|
|
|
|
const DEFAULT_IGNORE_FILENAME = '.stylelintignore';
|
|
|
|
/**
|
|
* @param {{ cwd: string, ignorePath?: string | string[], ignorePattern?: string[] }} options
|
|
* @return {import('ignore').Ignore}
|
|
*/
|
|
module.exports = function getFileIgnorer(options) {
|
|
const ignorer = ignore();
|
|
const ignorePaths = [options.ignorePath || []].flat();
|
|
|
|
if (ignorePaths.length === 0) {
|
|
ignorePaths.push(DEFAULT_IGNORE_FILENAME);
|
|
}
|
|
|
|
for (const ignoreFilePath of ignorePaths) {
|
|
const absoluteIgnoreFilePath = path.isAbsolute(ignoreFilePath)
|
|
? ignoreFilePath
|
|
: path.resolve(options.cwd, ignoreFilePath);
|
|
|
|
try {
|
|
const ignoreText = fs.readFileSync(absoluteIgnoreFilePath, 'utf8');
|
|
|
|
ignorer.add(ignoreText);
|
|
} catch (readError) {
|
|
if (!isPathNotFoundError(readError)) {
|
|
throw readError;
|
|
}
|
|
}
|
|
}
|
|
|
|
ignorer.add(options.ignorePattern || []);
|
|
|
|
return ignorer;
|
|
};
|