fix: prevent asset conflicts between React and Grid.js versions

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>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

51
node_modules/ps-list/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,51 @@
export interface Options {
/**
Include other users' processes as well as your own.
On Windows this has no effect and will always be the users' own processes.
@default true
*/
readonly all?: boolean;
}
export interface ProcessDescriptor {
readonly pid: number;
readonly name: string;
readonly ppid: number;
/**
Not supported on Windows.
*/
readonly cmd?: string;
/**
Not supported on Windows.
*/
readonly cpu?: number;
/**
Not supported on Windows.
*/
readonly memory?: number;
/**
Not supported on Windows.
*/
readonly uid?: number;
}
/**
Get running processes.
@returns A list of running processes.
@example
```
import psList from 'ps-list';
console.log(await psList());
//=> [{pid: 3213, name: 'node', cmd: 'node test.js', ppid: 1, uid: 501, cpu: 0.1, memory: 1.5}, …]
```
*/
export default function psList(options?: Options): Promise<ProcessDescriptor[]>;

138
node_modules/ps-list/index.js generated vendored Normal file
View File

@@ -0,0 +1,138 @@
import process from 'node:process';
import {promisify} from 'node:util';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import childProcess from 'node:child_process';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const TEN_MEGABYTES = 1000 * 1000 * 10;
const execFile = promisify(childProcess.execFile);
const windows = async () => {
// Source: https://github.com/MarkTiedemann/fastlist
let binary;
switch (process.arch) {
case 'x64':
binary = 'fastlist-0.3.0-x64.exe';
break;
case 'ia32':
binary = 'fastlist-0.3.0-x86.exe';
break;
default:
throw new Error(`Unsupported architecture: ${process.arch}`);
}
const binaryPath = path.join(__dirname, 'vendor', binary);
const {stdout} = await execFile(binaryPath, {
maxBuffer: TEN_MEGABYTES,
windowsHide: true,
});
return stdout
.trim()
.split('\r\n')
.map(line => line.split('\t'))
.map(([pid, ppid, name]) => ({
pid: Number.parseInt(pid, 10),
ppid: Number.parseInt(ppid, 10),
name,
}));
};
const nonWindowsMultipleCalls = async (options = {}) => {
const flags = (options.all === false ? '' : 'a') + 'wwxo';
const returnValue = {};
await Promise.all(['comm', 'args', 'ppid', 'uid', '%cpu', '%mem'].map(async cmd => {
const {stdout} = await execFile('ps', [flags, `pid,${cmd}`], {maxBuffer: TEN_MEGABYTES});
for (let line of stdout.trim().split('\n').slice(1)) {
line = line.trim();
const [pid] = line.split(' ', 1);
const value = line.slice(pid.length + 1).trim();
if (returnValue[pid] === undefined) {
returnValue[pid] = {};
}
returnValue[pid][cmd] = value;
}
}));
// Filter out inconsistencies as there might be race
// issues due to differences in `ps` between the spawns
return Object.entries(returnValue)
.filter(([, value]) => value.comm && value.args && value.ppid && value.uid && value['%cpu'] && value['%mem'])
.map(([key, value]) => ({
pid: Number.parseInt(key, 10),
name: path.basename(value.comm),
cmd: value.args,
ppid: Number.parseInt(value.ppid, 10),
uid: Number.parseInt(value.uid, 10),
cpu: Number.parseFloat(value['%cpu']),
memory: Number.parseFloat(value['%mem']),
}));
};
const ERROR_MESSAGE_PARSING_FAILED = 'ps output parsing failed';
const psOutputRegex = /^[ \t]*(?<pid>\d+)[ \t]+(?<ppid>\d+)[ \t]+(?<uid>[-\d]+)[ \t]+(?<cpu>\d+\.\d+)[ \t]+(?<memory>\d+\.\d+)[ \t]+(?<comm>.*)?/;
const nonWindowsCall = async (options = {}) => {
const flags = options.all === false ? 'wwxo' : 'awwxo';
const psPromises = [
execFile('ps', [flags, 'pid,ppid,uid,%cpu,%mem,comm'], {maxBuffer: TEN_MEGABYTES}),
execFile('ps', [flags, 'pid,args'], {maxBuffer: TEN_MEGABYTES}),
];
const [psLines, psArgsLines] = (await Promise.all(psPromises)).map(({stdout}) => stdout.trim().split('\n'));
const psPids = new Set(psPromises.map(promise => promise.child.pid));
psLines.shift();
psArgsLines.shift();
const processCmds = {};
for (const line of psArgsLines) {
const [pid, cmds] = line.trim().split(' ');
processCmds[pid] = cmds.join(' ');
}
const processes = psLines.map(line => {
const match = psOutputRegex.exec(line);
if (match === null) {
throw new Error(ERROR_MESSAGE_PARSING_FAILED);
}
const {pid, ppid, uid, cpu, memory, comm} = match.groups;
const processInfo = {
pid: Number.parseInt(pid, 10),
ppid: Number.parseInt(ppid, 10),
uid: Number.parseInt(uid, 10),
cpu: Number.parseFloat(cpu),
memory: Number.parseFloat(memory),
name: path.basename(comm),
cmd: processCmds[pid],
};
return processInfo;
}).filter(processInfo => !psPids.has(processInfo.pid));
return processes;
};
const nonWindows = async (options = {}) => {
try {
return await nonWindowsCall(options);
} catch { // If the error is not a parsing error, it should manifest itself in multicall version too.
return nonWindowsMultipleCalls(options);
}
};
const psList = process.platform === 'win32' ? windows : nonWindows;
export default psList;

9
node_modules/ps-list/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

40
node_modules/ps-list/package.json generated vendored Normal file
View File

@@ -0,0 +1,40 @@
{
"name": "ps-list",
"version": "8.1.1",
"description": "Get running processes",
"license": "MIT",
"repository": "sindresorhus/ps-list",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts",
"vendor/*.exe"
],
"keywords": [
"ps",
"proc",
"process",
"processes",
"list",
"running",
"tasklist"
],
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.18.0",
"xo": "^0.46.4"
}
}

47
node_modules/ps-list/readme.md generated vendored Normal file
View File

@@ -0,0 +1,47 @@
# ps-list
> Get running processes
Works on macOS, Linux, and Windows.
## Install
```sh
npm install ps-list
```
## Usage
```js
import psList from 'ps-list';
console.log(await psList());
//=> [{pid: 3213, name: 'node', cmd: 'node test.js', ppid: 1, uid: 501, cpu: 0.1, memory: 1.5}, …]
```
## API
### psList(options?)
Returns a `Promise<object[]>` with the running processes.
On macOS and Linux, the `name` property is truncated to 15 characters by the system. The `cmd` property can be used to extract the full name.
The `cmd`, `cpu`, `memory`, and `uid` properties are not supported on Windows.
#### options
Type: `object`
##### all
Type: `boolean`\
Default: `true`
Include other users' processes as well as your own.
On Windows this has no effect and will always be the users' own processes.
## Related
- [fastlist](https://github.com/MarkTiedemann/fastlist) - The binary used in this module to list the running processes on Windows

BIN
node_modules/ps-list/vendor/fastlist-0.3.0-x64.exe generated vendored Normal file

Binary file not shown.

BIN
node_modules/ps-list/vendor/fastlist-0.3.0-x86.exe generated vendored Normal file

Binary file not shown.