Files
formipay/node_modules/valtio/macro.js
dwindown e8fbfb14c1 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>
2026-04-18 17:02:14 +07:00

65 lines
2.4 KiB
JavaScript

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var helperModuleImports = require('@babel/helper-module-imports');
var t = require('@babel/types');
var babelPluginMacros = require('babel-plugin-macros');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var t__namespace = /*#__PURE__*/_interopNamespace(t);
var macro = function macro(_ref) {
var _references$useProxy;
var references = _ref.references;
(_references$useProxy = references.useProxy) == null ? void 0 : _references$useProxy.forEach(function (path) {
var _path$parentPath, _path$parentPath$get, _path$parentPath2, _path$parentPath2$par, _path$parentPath3, _path$parentPath3$get;
var hook = helperModuleImports.addNamed(path, 'useSnapshot', 'valtio');
var proxy = (_path$parentPath = path.parentPath) == null ? void 0 : (_path$parentPath$get = _path$parentPath.get('arguments.0')) == null ? void 0 : _path$parentPath$get.node;
if (!t__namespace.isIdentifier(proxy)) throw new babelPluginMacros.MacroError('no proxy object');
var snap = t__namespace.identifier("valtio_macro_snap_" + proxy.name);
(_path$parentPath2 = path.parentPath) == null ? void 0 : (_path$parentPath2$par = _path$parentPath2.parentPath) == null ? void 0 : _path$parentPath2$par.replaceWith(t__namespace.variableDeclaration('const', [t__namespace.variableDeclarator(snap, t__namespace.callExpression(hook, [proxy]))]));
var inFunction = 0;
(_path$parentPath3 = path.parentPath) == null ? void 0 : (_path$parentPath3$get = _path$parentPath3.getFunctionParent()) == null ? void 0 : _path$parentPath3$get.traverse({
Identifier: function Identifier(p) {
if (inFunction === 0 && p.node !== proxy && p.node.name === proxy.name) {
p.node.name = snap.name;
}
},
Function: {
enter: function enter() {
++inFunction;
},
exit: function exit() {
--inFunction;
}
}
});
});
};
var macro$1 = babelPluginMacros.createMacro(macro, {
configName: 'valtio'
});
exports["default"] = macro$1;