Skip to content

Commit

Permalink
DO NOT MERGE: what if we rebuild yarn.lock experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Jun 15, 2023
1 parent c224a3c commit 4cb7a94
Show file tree
Hide file tree
Showing 6 changed files with 905 additions and 847 deletions.
2 changes: 1 addition & 1 deletion packages/exo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export {
makeExo,
} from './src/exo-makers.js';

export { GET_INTERFACE_GUARD } from './src/exo-tools.js';
// export { GET_INTERFACE_GUARD } from './src/exo-tools.js';
26 changes: 13 additions & 13 deletions packages/exo/src/exo-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { listDifference, objectMap, mustMatch, M } from '@endo/patterns';

const { quote: q, Fail } = assert;
const { apply, ownKeys } = Reflect;
const { defineProperties } = Object;
const { defineProperties, getOwnPropertyDescriptors } = Object;

/**
* A method guard, for inclusion in an interface guard, that enforces only that
Expand Down Expand Up @@ -219,16 +219,10 @@ export const GET_INTERFACE_GUARD = Symbol.for('getInterfaceGuard');
/**
* @template {Record<string | symbol, CallableFunction>} T
* @param {T} behaviorMethods
* @param {(string | symbol)[]} methodNames
* @param {import('@endo/patterns').InterfaceGuard} interfaceGuard
*/
const addGetInterfaceGuardMethod = (
behaviorMethods,
methodNames,
interfaceGuard,
) => {
const addGetInterfaceGuardMethod = (behaviorMethods, interfaceGuard) => {
if (!hasOwnPropertyOf(behaviorMethods, GET_INTERFACE_GUARD)) {
methodNames.push(GET_INTERFACE_GUARD);
// Note that we do not also update the interfaceGuard to describe this
// meta method. Currently, it is a symbol-named method, so we cannot
// anyway.
Expand Down Expand Up @@ -264,12 +258,15 @@ export const defendPrototype = (
thisfulMethods = false,
interfaceGuard = undefined,
) => {
// local mutable copy
defineProperties(behaviorMethods, getOwnPropertyDescriptors(behaviorMethods));
const prototype = {};
const methodNames = ownKeys(behaviorMethods).filter(
if (hasOwnPropertyOf(behaviorMethods, 'constructor')) {
// By ignoring any method named "constructor", we can use a
// class.prototype as a behaviorMethods.
name => name !== 'constructor',
);
// @ts-expect-error TS misses that hasOwn check makes this safe
assert(delete behaviorMethods.constructor);
}
let methodGuards;
if (interfaceGuard) {
const {
Expand All @@ -282,6 +279,7 @@ export const defendPrototype = (
assert.equal(klass, 'Interface');
assert.typeof(interfaceName, 'string');
{
const methodNames = ownKeys(behaviorMethods);
const methodGuardNames = ownKeys(methodGuards);
const unimplemented = listDifference(methodGuardNames, methodNames);
unimplemented.length === 0 ||
Expand All @@ -292,9 +290,11 @@ export const defendPrototype = (
Fail`methods ${q(unguarded)} not guarded by ${q(interfaceName)}`;
}
}
addGetInterfaceGuardMethod(behaviorMethods, methodNames, interfaceGuard);
// mutates behaviorMethods
addGetInterfaceGuardMethod(behaviorMethods, interfaceGuard);
}
for (const prop of methodNames) {

for (const prop of ownKeys(behaviorMethods)) {
prototype[prop] = bindMethod(
`In ${q(prop)} method of (${tag})`,
contextProvider,
Expand Down
60 changes: 30 additions & 30 deletions packages/exo/test/test-heap-classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
defineExoClassKit,
makeExo,
} from '../src/exo-makers.js';
import { GET_INTERFACE_GUARD } from '../src/exo-tools.js';
// import { GET_INTERFACE_GUARD } from '../src/exo-tools.js';

const { ownKeys } = Reflect;

Expand Down Expand Up @@ -51,7 +51,7 @@ test('test defineExoClass', t => {
message:
'In "incr" method of (UpCounter): arg 0?: string "foo" - Must be a number',
});
t.deepEqual(upCounter[GET_INTERFACE_GUARD](), UpCounterI);
// t.deepEqual(upCounter[GET_INTERFACE_GUARD](), UpCounterI);
t.deepEqual(ownKeys(UpCounterI.methodGuards), ['incr']);
});

Expand Down Expand Up @@ -99,8 +99,8 @@ test('test defineExoClassKit', t => {
t.throws(() => upCounter.decr(3), {
message: 'upCounter.decr is not a function',
});
t.deepEqual(upCounter[GET_INTERFACE_GUARD](), UpCounterI);
t.deepEqual(downCounter[GET_INTERFACE_GUARD](), DownCounterI);
// t.deepEqual(upCounter[GET_INTERFACE_GUARD](), UpCounterI);
// t.deepEqual(downCounter[GET_INTERFACE_GUARD](), DownCounterI);
});

test('test makeExo', t => {
Expand All @@ -121,7 +121,7 @@ test('test makeExo', t => {
message:
'In "incr" method of (upCounter): arg 0?: string "foo" - Must be a number',
});
t.deepEqual(upCounter[GET_INTERFACE_GUARD](), UpCounterI);
// t.deepEqual(upCounter[GET_INTERFACE_GUARD](), UpCounterI);
});

// For code sharing with defineKind which does not support an interface
Expand All @@ -142,9 +142,9 @@ test('missing interface', t => {
message:
'In "makeSayHello" method of (greeterMaker): result: "[Symbol(passStyle)]" property expected: "[Function <anon>]"',
});
t.throws(() => greeterMaker[GET_INTERFACE_GUARD](), {
message: 'greeterMaker[GET_INTERFACE_GUARD] is not a function',
});
// t.throws(() => greeterMaker[GET_INTERFACE_GUARD](), {
// message: 'greeterMaker[GET_INTERFACE_GUARD] is not a function',
// });
});

const SloppyGreeterI = M.interface('greeter', {}, { sloppy: true });
Expand All @@ -157,7 +157,7 @@ test('sloppy option', t => {
},
});
t.is(greeter.sayHello(), 'hello');
t.deepEqual(greeter[GET_INTERFACE_GUARD](), SloppyGreeterI);
// t.deepEqual(greeter[GET_INTERFACE_GUARD](), SloppyGreeterI);

t.throws(
() =>
Expand All @@ -175,30 +175,30 @@ test('sloppy option', t => {
);
});

const GreeterI = M.interface('greeter', {
sayHello: M.call().returns('hello'),
});
// const GreeterI = M.interface('greeter', {
// sayHello: M.call().returns('hello'),
// });

test('naked function call', t => {
const greeter = makeExo('greeter', GreeterI, {
sayHello() {
return 'hello';
},
});
// test('naked function call', t => {
// const greeter = makeExo('greeter', GreeterI, {
// sayHello() {
// return 'hello';
// },
// });

const { sayHello, [GET_INTERFACE_GUARD]: gigm } = greeter;
t.throws(() => sayHello(), {
message:
'thisful method "In \\"sayHello\\" method of (greeter)" called without \'this\' object',
});
t.is(sayHello.bind(greeter)(), 'hello');
// const { sayHello, [GET_INTERFACE_GUARD]: gigm } = greeter;
// t.throws(() => sayHello(), {
// message:
// 'thisful method "In \\"sayHello\\" method of (greeter)" called without \'this\' object',
// });
// t.is(sayHello.bind(greeter)(), 'hello');

t.throws(() => gigm(), {
message:
'thisful method "In \\"[Symbol(getInterfaceGuard)]\\" method of (greeter)" called without \'this\' object',
});
t.deepEqual(gigm.bind(greeter)(), GreeterI);
});
// t.throws(() => gigm(), {
// message:
// 'thisful method "In \\"[Symbol(getInterfaceGuard)]\\" method of (greeter)" called without \'this\' object',
// });
// t.deepEqual(gigm.bind(greeter)(), GreeterI);
// });

// needn't run. we just don't have a better place to write these.
test.skip('types', () => {
Expand Down
4 changes: 4 additions & 0 deletions packages/ses/src/whitelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,10 @@ export const whitelist = {
toPrimitive: 'symbol',
toStringTag: 'symbol',
unscopables: 'symbol',
// Seen at core-js https://github.com/zloirock/core-js#ecmascript-symbol
useSimple: false,
// Seen at core-js https://github.com/zloirock/core-js#ecmascript-symbol
useSetter: false,
},

'%SymbolPrototype%': {
Expand Down
2 changes: 1 addition & 1 deletion patches/@lerna+conventional-commits+5.6.2.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/@lerna/conventional-commits/lib/recommend-version.js b/node_modules/@lerna/conventional-commits/lib/recommend-version.js
index 4551feb..b678322 100644
index a982adf..90a19ea 100644
--- a/node_modules/@lerna/conventional-commits/lib/recommend-version.js
+++ b/node_modules/@lerna/conventional-commits/lib/recommend-version.js
@@ -82,6 +82,8 @@ function recommendVersion(pkg, type, { changelogPreset, rootPath, tagPrefix, pre
Expand Down
Loading

0 comments on commit 4cb7a94

Please sign in to comment.