Skip to content

Commit

Permalink
Merge branch 'master' into naugtur/fix-defering-errors
Browse files Browse the repository at this point in the history
# By Turadg Aleahmad (11) and others
# Via GitHub (4) and Kris Kowal (1)
* master:
  docs(ses): Finish embracing permits terminology
  fix(ses): Clarify lockdown types
  feat(ses): Lockdown reporting option
  chore(deps): yarn dedupe
  chore(types): fix import tags
  lint: enable jsdoc/recommended-typescript-flavor
  chore: rm dup config key
  chore(deps): bump eslint-plugin-jsdoc
  build(deps): bump typescript (patch)
  chore(types): conform to verbatimModuleSyntax
  ci: enable verbatimModuleSyntax
  style: prettier
  chore(deps): bump prettier
  build(deps): bump yarn to 4.5.1
  feat(compartment-mapper): Collect unretained module descriptors
  test(compartment-mapper): Mark and sweep unused module descriptors
  feat(ses): permit Promise.prototype.try (#2609)

# Conflicts:
#	packages/compartment-mapper/NEWS.md
  • Loading branch information
boneskull committed Nov 4, 2024
2 parents a04f06b + 08d3945 commit 35dcdbc
Show file tree
Hide file tree
Showing 80 changed files with 740 additions and 705 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"engines": {
"node": ">=16"
},
"packageManager": "yarn@4.4.0",
"packageManager": "yarn@4.5.1",
"devDependencies": {
"@jessie.js/eslint-plugin": "^0.4.1",
"@octokit/core": "^3.4.0",
Expand All @@ -18,13 +18,13 @@
"eslint-config-jessie": "^0.0.6",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.2.5",
"eslint-plugin-jsdoc": "^50.4.3",
"lerna": "^8.1.8",
"prettier": "^3.2.5",
"prettier": "^3.3.3",
"type-coverage": "^2.29.1",
"typedoc": "^0.26.6",
"typedoc-plugin-markdown": "^4.2.5",
"typescript": "~5.6.2",
"typescript": "~5.6.3",
"typescript-eslint": "^7.3.1",
"zx": "^8.1.8"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/base64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"prettier": "^3.2.5",
"typescript": "~5.6.2"
"prettier": "^3.3.3",
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundle-source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"ava": "^6.1.3",
"c8": "^7.14.0",
"eslint": "^8.57.0",
"typescript": "~5.6.2"
"typescript": "~5.6.3"
},
"keywords": [],
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/captp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@endo/ses-ava": "workspace:^",
"ava": "^6.1.3",
"c8": "^7.14.0",
"typescript": "~5.6.2"
"typescript": "~5.6.3"
},
"dependencies": {
"@endo/errors": "workspace:^",
Expand Down
4 changes: 2 additions & 2 deletions packages/check-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"prettier": "^3.2.5",
"typescript": "~5.6.2"
"prettier": "^3.3.3",
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/cjs-module-analyzer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"prettier": "^3.2.5",
"typescript": "~5.6.2"
"prettier": "^3.3.3",
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"execa": "^9.3.0",
"prettier": "^3.2.5",
"typescript": "~5.6.2"
"prettier": "^3.3.3",
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/_types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Execa } from 'execa';

export type Expectation = {
stdout: RegExp | string | undefined;
stderr: RegExp | string | undefined;
stderr?: RegExp | string | undefined;
};
export type TestCommand = (
command: ReturnType<Execa>,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/demo/confined-script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @import {TestRoutine} from '../types */
/** @import {TestRoutine} from '../_types.js'; */

/** @type {TestRoutine} */
export const section = async (execa, testLine) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"ava": "^6.1.3",
"c8": "^7.14.0",
"tsd": "^0.31.2",
"typescript": "~5.6.2"
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
4 changes: 3 additions & 1 deletion packages/compartment-mapper/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
User-visible changes to `@endo/compartment-mapper`:

# Next release
# Next version

- Omits unused module descriptors from `compartment-map.json` in archived
applications, potentially reducing file sizes.
- Fixes an issue where errors thrown from exit module hooks (`importHook`) would
be thrown at parse-time instead of at runtime. Such errors will now be thrown
at runtime, as expected. To those who expected the previous behavior: if you
Expand Down
4 changes: 2 additions & 2 deletions packages/compartment-mapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"prettier": "^3.2.5",
"typescript": "~5.6.2"
"prettier": "^3.3.3",
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
23 changes: 13 additions & 10 deletions packages/compartment-mapper/src/archive-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,25 @@ const translateCompartmentMap = (compartments, sources, compartmentRenames) => {
const result = create(null);
for (const compartmentName of keys(compartmentRenames)) {
const compartment = compartments[compartmentName];
const { name, label, retained, policy } = compartment;
if (retained) {
const { name, label, retained: compartmentRetained, policy } = compartment;
if (compartmentRetained) {
// rename module compartments
/** @type {Record<string, ModuleDescriptor>} */
const modules = create(null);
const compartmentModules = compartment.modules;
if (compartment.modules) {
for (const name of keys(compartmentModules).sort()) {
const module = compartmentModules[name];
if (module.compartment !== undefined) {
modules[name] = {
...module,
compartment: compartmentRenames[module.compartment],
};
} else {
modules[name] = module;
const { retained: moduleRetained, ...retainedModule } =
compartmentModules[name];
if (moduleRetained) {
if (retainedModule.compartment !== undefined) {
modules[name] = {
...retainedModule,
compartment: compartmentRenames[retainedModule.compartment],
};
} else {
modules[name] = retainedModule;
}
}
}
}
Expand Down
9 changes: 8 additions & 1 deletion packages/compartment-mapper/src/compartment-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const assertConditions = (conditions, url) => {
* @param {string} url
*/
const assertCompartmentModule = (allegedModule, path, url) => {
const { compartment, module, ...extra } = allegedModule;
const { compartment, module, retained, ...extra } = allegedModule;
assertEmptyObject(
extra,
`${path} must not have extra properties, got ${q({
Expand All @@ -125,6 +125,13 @@ const assertCompartmentModule = (allegedModule, path, url) => {
'string',
`${path}.module must be a string, got ${q(module)} in ${q(url)}`,
);
if (retained !== undefined) {
assert.typeof(
retained,
'boolean',
`${path}.retained must be a boolean, got ${q(retained)} in ${q(url)}`,
);
}
};

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/compartment-mapper/src/import-hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ function* chooseModuleDescriptor(
for (const candidateSpecifier of candidates) {
const candidateModuleDescriptor = moduleDescriptors[candidateSpecifier];
if (candidateModuleDescriptor !== undefined) {
candidateModuleDescriptor.retained = true;
const { compartment: candidateCompartmentName = packageLocation } =
candidateModuleDescriptor;
const candidateCompartment = compartments[candidateCompartmentName];
Expand Down Expand Up @@ -339,6 +340,7 @@ function* chooseModuleDescriptor(
// module specifier than the requested one.
if (candidateSpecifier !== moduleSpecifier) {
moduleDescriptors[moduleSpecifier] = {
retained: true,
module: candidateSpecifier,
compartment: packageLocation,
};
Expand Down
3 changes: 3 additions & 0 deletions packages/compartment-mapper/src/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ const makeModuleMapHook = (

const moduleDescriptor = moduleDescriptors[moduleSpecifier];
if (moduleDescriptor !== undefined) {
moduleDescriptor.retained = true;

// "foreignCompartmentName" refers to the compartment which
// may differ from the current compartment
const {
Expand Down Expand Up @@ -193,6 +195,7 @@ const makeModuleMapHook = (
// a moduleMapHook when we assemble compartments from the resulting
// archive.
moduleDescriptors[moduleSpecifier] = {
retained: true,
compartment: foreignCompartmentName,
module: foreignModuleSpecifier,
};
Expand Down
3 changes: 2 additions & 1 deletion packages/compartment-mapper/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ export {};
* `package.json`, there is a corresponding module descriptor.
*
* @typedef {object} ModuleDescriptor
* @property {string=} [compartment]
* @property {string} [compartment]
* @property {string} [module]
* @property {string} [location]
* @property {Language} [parser]
* @property {string} [sha512] in base 16, hex
* @property {string} [exit]
* @property {string} [deferredError]
* @property {boolean} [retained]
*/

/**
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions packages/compartment-mapper/test/retained.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,14 @@ test('archives only contain compartments retained by modules', async t => {
// Notably absent:
// 'sweep-v1.0.0',
]);
t.deepEqual(
Object.keys(compartmentMap.compartments['app-v1.0.0'].modules).sort(),
[
'./app.js',
// Notably absent: 'app',
'mk1',
// Notably absent: 'mk1/bogus.js',
// Notably absent: 'sweep',
],
);
});
4 changes: 2 additions & 2 deletions packages/daemon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"prettier": "^3.2.5",
"typescript": "~5.6.2"
"prettier": "^3.3.3",
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/daemon/src/worker-node-powers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { makeNodeReader, makeNodeWriter } from '@endo/stream-node';

/** @import { MignonicPowers } from './types.js' } */
/** @import {MignonicPowers} from './types.js'; */

/**
* @param {object} modules
Expand Down
4 changes: 2 additions & 2 deletions packages/env-options/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"prettier": "^3.2.5",
"typescript": "~5.6.2"
"prettier": "^3.3.3",
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"c8": "^7.14.0",
"ses0_18_3": "npm:[email protected]",
"tsd": "^0.31.2",
"typescript": "~5.6.2"
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
13 changes: 5 additions & 8 deletions packages/eslint-plugin/lib/configs/style.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module.exports = {
extends: ['airbnb-base', 'plugin:jsdoc/recommended', 'prettier'],
extends: [
'airbnb-base',
'plugin:jsdoc/recommended-typescript-flavor',
'prettier',
],
rules: {
quotes: [
'error',
Expand All @@ -22,13 +26,6 @@ module.exports = {
'prefer-regex-literals': 'off',
'no-else-return': 'off',
'no-console': 'off',
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'no-return-assign': 'off',
'no-param-reassign': 'off',
'no-promise-executor-return': 'off', // common to return setTimeout(), we know the value won't be accessible
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"requireindex": "~1.1.0",
"tsutils": "~3.21.0",
"typescript": "~5.6.2",
"typescript": "~5.6.3",
"typescript-eslint": "^7.3.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/evasive-transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"eslint": "^8.57.0",
"rollup": "^2.79.1",
"tsd": "^0.31.2",
"typescript": "~5.6.2"
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/eventual-send/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"ava": "^6.1.3",
"c8": "^7.14.0",
"tsd": "^0.31.2",
"typescript": "~5.6.2"
"typescript": "~5.6.3"
},
"keywords": [
"eventual send",
Expand Down
4 changes: 2 additions & 2 deletions packages/exo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"prettier": "^3.2.5",
"typescript": "~5.6.2"
"prettier": "^3.3.3",
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/far/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@endo/ses-ava": "workspace:^",
"ava": "^6.1.3",
"c8": "^7.14.0",
"typescript": "~5.6.2"
"typescript": "~5.6.3"
},
"keywords": [
"eventual send",
Expand Down
2 changes: 1 addition & 1 deletion packages/immutable-arraybuffer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"ava": "^6.1.3",
"c8": "^7.14.0",
"tsd": "^0.31.2",
"typescript": "~5.6.2"
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/import-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@endo/ses-ava": "workspace:^",
"ava": "^6.1.3",
"c8": "^7.14.0",
"typescript": "~5.6.2"
"typescript": "~5.6.3"
},
"files": [
"./*.d.ts",
Expand Down
Loading

0 comments on commit 35dcdbc

Please sign in to comment.