Mirror: The small sibling of the graphql package, slimmed down for client-side libraries.

Remove Object.freeze using transform

Changed files
+21
scripts
+19
scripts/babel/transformObjectFreeze.mjs
···
···
+
const plugin = ({ types: t }) => {
+
return {
+
visitor: {
+
CallExpression(path) {
+
if (
+
t.isMemberExpression(path.node.callee) &&
+
t.isIdentifier(path.node.callee.object) &&
+
t.isIdentifier(path.node.callee.property) &&
+
path.node.callee.object.name === 'Object' &&
+
path.node.callee.property.name === 'freeze'
+
) {
+
path.replaceWith(path.node.arguments[0]);
+
}
+
},
+
}
+
};
+
};
+
+
export default plugin;
+2
scripts/rollup/config.mjs
···
import babelModularGraphQL from 'babel-plugin-modular-graphql';
import babelTransformDevAssert from '../babel/transformDevAssert.mjs';
const cwd = process.cwd();
const externalModules = ['dns', 'fs', 'path', 'url'];
···
presets: [],
plugins: [
babelTransformDevAssert,
babelModularGraphQL,
'reghex/babel',
],
···
import babelModularGraphQL from 'babel-plugin-modular-graphql';
import babelTransformDevAssert from '../babel/transformDevAssert.mjs';
+
import babelTransformObjectFreeze from '../babel/transformObjectFreeze.mjs';
const cwd = process.cwd();
const externalModules = ['dns', 'fs', 'path', 'url'];
···
presets: [],
plugins: [
babelTransformDevAssert,
+
babelTransformObjectFreeze,
babelModularGraphQL,
'reghex/babel',
],