Skip to content
Draft
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
RUNNING_IN_CI: true
run: pnpm test

- name: Test ESM and CJS consumers
run: pnpm test:esm-consumer && pnpm test:cjs-consumer

- name: Check examples & demos
run: pnpm check-examples

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "monorepo",
"private": true,
"license": "GPL-3.0-only",
"author": "Piotr Roslaniec <p.roslaniec@gmail.com>",
"author": "NuCypher <dev@nucypher.com>",
"scripts": {
"postinstall": "pnpm build",
"typedoc": "typedoc",
Expand All @@ -12,9 +12,11 @@
"lint": "pnpm run --parallel --aggregate-output --reporter append-only lint",
"lint:fix": "pnpm --parallel --aggregate-output --reporter append-only lint:fix",
"type-check": "pnpm --parallel --aggregate-output --reporter append-only type-check",
"build": "tsc --build --verbose ./tsconfig.prod.json",
"build": "tsc --build --verbose ./tsconfig.prod.json && node scripts/fix-dist-markers.cjs",
"watch": "tsc --build --verbose --watch ./tsconfig.prod.json",
"test": "pnpm build && vitest run",
"test:esm-consumer": "node scripts/test-consumer.cjs esm",
"test:cjs-consumer": "node scripts/test-consumer.cjs cjs",
"package:check": "pnpm run --parallel --aggregate-output --reporter append-only --filter './packages/**' package-check",
"packages:lint": "pnpm packages:sort --check",
"packages:sort": "sort-package-json \"package.json\" \"examples/*/package.json\" \"packages/*/package.json\"",
Expand Down
5 changes: 5 additions & 0 deletions packages/pre/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const baseConfig = require('../../.eslintrc.cjs');

module.exports = {
...baseConfig,
};
5 changes: 0 additions & 5 deletions packages/pre/.eslintrc.js

This file was deleted.

15 changes: 11 additions & 4 deletions packages/pre/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
"url": "https://github.com/nucypher/taco-web"
},
"license": "GPL-3.0-only",
"author": "Piotr Roslaniec <p.roslaniec@gmail.com>",
"author": "NuCypher <dev@nucypher.com>",
"exports": {
".": {
"import": "./dist/es/index.js",
"require": "./dist/cjs/index.js"
"import": {
"types": "./dist/es/index.d.ts",
"default": "./dist/es/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
}
},
"main": "./dist/cjs/index.js",
Expand All @@ -26,7 +32,8 @@
],
"scripts": {
"prebuild": "pnpm clean",
"build": "pnpm build:module && pnpm build:cjs",
"build": "pnpm build:module && pnpm build:cjs && pnpm postbuild",
"postbuild": "node ../../scripts/fix-dist-markers.cjs .",
"build:cjs": "tsc --build ./tsconfig.cjs.json --verbose",
"build:module": "tsc --build ./tsconfig.es.json --verbose",
"clean": "rm -rf dist",
Expand Down
6 changes: 3 additions & 3 deletions packages/pre/src/characters/alice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import {
import { ChecksumAddress, Domain, PorterClient } from '@nucypher/shared';
import { ethers } from 'ethers';

import { Keyring } from '../keyring';
import { Keyring } from '../keyring.js';
import {
BlockchainPolicy,
BlockchainPolicyParameters,
EnactedPolicy,
PreEnactedPolicy,
} from '../policy';
} from '../policy.js';

import { RemoteBob } from './bob';
import { RemoteBob } from './bob.js';

export class Alice {
private readonly keyring: Keyring;
Expand Down
4 changes: 2 additions & 2 deletions packages/pre/src/characters/bob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
} from '@nucypher/nucypher-core';
import { ChecksumAddress, PorterClient, zip } from '@nucypher/shared';

import { Keyring } from '../keyring';
import { PolicyMessageKit, RetrievalResult } from '../kits';
import { Keyring } from '../keyring.js';
import { PolicyMessageKit, RetrievalResult } from '../kits/index.js';

export class RemoteBob {
private constructor(
Expand Down
2 changes: 1 addition & 1 deletion packages/pre/src/characters/enrico.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MessageKit, PublicKey, SecretKey } from '@nucypher/nucypher-core';
import { toBytes } from '@nucypher/shared';

import { Keyring } from '../keyring';
import { Keyring } from '../keyring.js';

export class Enrico {
public readonly encryptingKey: PublicKey;
Expand Down
6 changes: 3 additions & 3 deletions packages/pre/src/characters/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './alice';
export * from './bob';
export * from './enrico';
export * from './alice.js';
export * from './bob.js';
export * from './enrico.js';
6 changes: 3 additions & 3 deletions packages/pre/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export {
toHexString,
} from '@nucypher/shared';

export { Alice, Bob, Enrico } from './characters';
export { Cohort } from './cohort';
export { EnactedPolicy } from './policy';
export { Alice, Bob, Enrico } from './characters/index.js';
export { Cohort } from './cohort.js';
export { EnactedPolicy } from './policy.js';
2 changes: 1 addition & 1 deletion packages/pre/src/keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@nucypher/nucypher-core';
import { toBytes } from '@nucypher/shared';

import { PolicyMessageKit } from './kits';
import { PolicyMessageKit } from './kits/index.js';

export class Keyring {
constructor(public readonly secretKey: SecretKey) {}
Expand Down
4 changes: 2 additions & 2 deletions packages/pre/src/kits/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './message';
export * from './retrieval';
export * from './message.js';
export * from './retrieval.js';
2 changes: 1 addition & 1 deletion packages/pre/src/kits/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@nucypher/nucypher-core';
import { ChecksumAddress } from '@nucypher/shared';

import { RetrievalResult } from './retrieval';
import { RetrievalResult } from './retrieval.js';

export class PolicyMessageKit {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion packages/pre/src/policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from '@nucypher/shared';
import { ethers } from 'ethers';

import { Alice, RemoteBob } from './characters';
import { Alice, RemoteBob } from './characters/index.js';

export type EnactedPolicy = {
readonly id: HRAC;
Expand Down
4 changes: 2 additions & 2 deletions packages/pre/test/acceptance/alice-grants.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '@nucypher/test-utils';
import { beforeEach, describe, expect, it } from 'vitest';

import { EnactedPolicy, Enrico, toBytes } from '../../src';
import { EnactedPolicy, Enrico, toBytes } from '../../src/index.js';
import {
fakeAlice,
fakeBob,
Expand All @@ -27,7 +27,7 @@ import {
mockMakeTreasureMap,
mockPublishToBlockchain,
reencryptKFrags,
} from '../utils';
} from '../utils.js';

describe('story: alice shares message with bob through policy', () => {
const message = 'secret-message-from-alice';
Expand Down
4 changes: 2 additions & 2 deletions packages/pre/test/acceptance/delay-enact.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import {
} from '@nucypher/test-utils';
import { beforeAll, describe, expect, it } from 'vitest';

import { domains, initialize } from '../../src';
import { domains, initialize } from '../../src/index.js';
import {
fakeAlice,
fakeRemoteBob,
mockEncryptTreasureMap,
mockGenerateKFrags,
mockPublishToBlockchain,
} from '../utils';
} from '../utils.js';

describe('story: alice creates a policy but someone else enacts it', () => {
const threshold = 2;
Expand Down
4 changes: 2 additions & 2 deletions packages/pre/test/cohort.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { initialize } from '@nucypher/shared';
import { fakeUrsulas } from '@nucypher/test-utils';
import { beforeAll, describe, expect, it } from 'vitest';

import { Cohort } from '../src';
import { Cohort } from '../src/index.js';

import { makeCohort } from './utils';
import { makeCohort } from './utils.js';

describe('Cohort', () => {
beforeAll(async () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/pre/test/enrico.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import { bytesEqual, fromBytes } from '@nucypher/test-utils';
import { beforeAll, describe, expect, it } from 'vitest';

import { Enrico, initialize, toBytes } from '../src';
import { PolicyMessageKit, RetrievalResult } from '../src/kits';
import { Enrico, initialize, toBytes } from '../src/index.js';
import { PolicyMessageKit, RetrievalResult } from '../src/kits/index.js';

import { fakeAlice, fakeBob, reencryptKFrags } from './utils';
import { fakeAlice, fakeBob, reencryptKFrags } from './utils.js';

describe('enrico', () => {
beforeAll(async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/pre/test/message-kit.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { beforeAll, describe, expect, it } from 'vitest';

import { initialize, MessageKit, toBytes } from '../src';
import { initialize, MessageKit, toBytes } from '../src/index.js';

import { fakeBob } from './utils';
import { fakeBob } from './utils.js';

describe('message kit', () => {
beforeAll(async () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/pre/test/pre.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { zip } from '@nucypher/shared';
import { fakeUrsulas } from '@nucypher/test-utils';
import { beforeAll, describe, expect, it } from 'vitest';

import { Alice, Bob, Enrico, MessageKit, toBytes } from '../src';
import { PolicyMessageKit, RetrievalResult } from '../src/kits';
import { Alice, Bob, Enrico, MessageKit, toBytes } from '../src/index.js';
import { PolicyMessageKit, RetrievalResult } from '../src/kits/index.js';

import { fakeAlice, fakeBob, reencryptKFrags } from './utils';
import { fakeAlice, fakeBob, reencryptKFrags } from './utils.js';

describe('proxy reencryption', () => {
let alice: Alice;
Expand Down
6 changes: 3 additions & 3 deletions packages/pre/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { Ursula } from '@nucypher/shared';
import { fakeUrsulas, mockGetUrsulas } from '@nucypher/test-utils';
import { expect, MockInstance, vi } from 'vitest';

import { Alice, Bob, Cohort, toBytes } from '../src';
import { RemoteBob } from '../src/characters';
import { BlockchainPolicy, PreEnactedPolicy } from '../src/policy';
import { RemoteBob } from '../src/characters/index.js';
import { Alice, Bob, Cohort, toBytes } from '../src/index.js';
import { BlockchainPolicy, PreEnactedPolicy } from '../src/policy.js';

export const fakeBob = (): Bob => {
const secretKey = SecretKey.fromBEBytes(
Expand Down
3 changes: 2 additions & 1 deletion packages/pre/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "./tsconfig.es.json",
"compilerOptions": {
"outDir": "dist/cjs",
"module": "CommonJS"
"module": "CommonJS",
"moduleResolution": "node"
Comment on lines +5 to +6
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moduleResolution is set to node while the package now uses .js in TS import specifiers. This is likely to break the CJS tsc --build step because TypeScript won't resolve ./foo.js to ./foo.ts under node resolution. Consider switching to node16/nodenext (or keeping Bundler).

Suggested change
"module": "CommonJS",
"moduleResolution": "node"
"module": "Node16",
"moduleResolution": "node16"

Copilot uses AI. Check for mistakes.
}
}
1 change: 1 addition & 0 deletions packages/pre/tsconfig.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"outDir": "dist/es",
"rootDir": "src",
"module": "ES2022",
"moduleResolution": "Bundler",
"target": "ES2022"
}
}
5 changes: 5 additions & 0 deletions packages/shared/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const baseConfig = require('../../.eslintrc.cjs');

module.exports = {
...baseConfig,
};
5 changes: 0 additions & 5 deletions packages/shared/.eslintrc.js

This file was deleted.

15 changes: 11 additions & 4 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nucypher/shared",
"version": "0.6.0-alpha.12",
"version": "0.6.0-dev.es",
"keywords": [
"pre",
"taco",
Expand All @@ -15,8 +15,14 @@
"author": "NuCypher <dev@nucypher.com>",
"exports": {
".": {
"import": "./dist/es/index.js",
"require": "./dist/cjs/index.js"
"import": {
"types": "./dist/es/index.d.ts",
"default": "./dist/es/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
}
},
"main": "./dist/cjs/index.js",
Expand All @@ -27,7 +33,8 @@
],
"scripts": {
"prebuild": "pnpm typechain && pnpm clean",
"build": "pnpm build:module && pnpm build:cjs",
"build": "pnpm build:module && pnpm build:cjs && pnpm postbuild",
"postbuild": "node ../../scripts/fix-dist-markers.cjs .",
"build:cjs": "tsc --build ./tsconfig.cjs.json --verbose",
"build:module": "tsc --build ./tsconfig.es.json --verbose",
"clean": "rm -rf dist",
Expand Down
Loading
Loading