Skip to content

Commit a9c10d8

Browse files
authored
Move remaining packages to ESM (#431)
1 parent 7337a6f commit a9c10d8

20 files changed

+35
-25
lines changed

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
defaultSemverRangePrefix: ""
2+
enableConstraintsChecks: true
23
enableInlineBuilds: true
34
enableTelemetry: false
45
nodeLinker: node-modules

workspaces/adventure-pack/goodies/typescript/Iterator.from/index.test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import { describe, expect, it } from "@jest/globals";
22

3-
import "../Iterator.prototype.map";
4-
import "../Iterator.prototype.filter";
3+
import "../Iterator.prototype.map/index.ts";
4+
import "../Iterator.prototype.filter/index.ts";
55

66
(globalThis as Record<string, unknown>).Iterator &&
77
delete (
88
(globalThis as Record<string, unknown>).Iterator as Record<string, unknown>
99
).from;
10-
11-
// eslint-disable-next-line import-x/first
12-
import "./index";
10+
// eslint-disable-next-line import-x/first -- This has to happen after we delete the built-in implementation.
11+
import "./index.ts";
1312

1413
describe("Iterator.from", () => {
1514
it("can convert an Array to an Iterator", () => {

workspaces/adventure-pack/goodies/typescript/Iterator.from/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ declare global {
1212
}
1313

1414
(globalThis as Record<string, unknown>).Iterator ??= {};
15-
1615
((globalThis as Record<string, unknown>).Iterator as { from: unknown }).from ??=
1716
function <T>(
1817
object: Iterator<T> | Iterable<T> | { next(): IteratorResult<T> },

workspaces/adventure-pack/src/app/__tests__/__snapshots__/equip-test.ts.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,6 @@ iteratorPrototype.toIterable = function () {
13831383
};
13841384

13851385
globalThis.Iterator ??= {};
1386-
13871386
globalThis.Iterator.from ??= function (object) {
13881387
const toIterable = iteratorPrototype.toIterable;
13891388

@@ -3366,7 +3365,6 @@ iteratorPrototype.toIterable = function <T>(
33663365
};
33673366

33683367
(globalThis as Record<string, unknown>).Iterator ??= {};
3369-
33703368
((globalThis as Record<string, unknown>).Iterator as { from: unknown }).from ??=
33713369
function <T>(
33723370
object: Iterator<T> | Iterable<T> | { next(): IteratorResult<T> },

workspaces/adventure-pack/src/app/__tests__/__snapshots__/render-test.ts.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,6 @@ exports[`App can render goody: JavaScript Iterator.from 1`] = `
805805
import "Iterator.prototype.toIterable";
806806
807807
globalThis.Iterator ??= {};
808-
809808
globalThis.Iterator.from ??= function (object) {
810809
const toIterable = iteratorPrototype.toIterable;
811810
@@ -1984,7 +1983,6 @@ declare global {
19841983
}
19851984
19861985
(globalThis as Record<string, unknown>).Iterator ??= {};
1987-
19881986
((globalThis as Record<string, unknown>).Iterator as { from: unknown }).from ??=
19891987
function <T>(
19901988
object: Iterator<T> | Iterable<T> | { next(): IteratorResult<T> },

workspaces/eslint-config/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"name": "Miorel-Lucian Palii",
1313
"url": "https://github.com/miorel"
1414
},
15+
"type": "module",
1516
"exports": {
1617
".": "./eslint.config.mjs"
1718
},

workspaces/generate-health-report/src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { maybeThrow } from "@code-chronicles/util/maybeThrow";
1010
import { spawnWithSafeStdio } from "@code-chronicles/util/spawnWithSafeStdio";
1111

1212
const COMMANDS = [
13+
"yarn constraints",
1314
"yarn test",
1415
"yarn workspace @code-chronicles/adventure-pack build-app",
1516
"yarn workspace @code-chronicles/adventure-pack build-chrome-extension",
File renamed without changes.

workspaces/util/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,26 @@
1212
"name": "Miorel-Lucian Palii",
1313
"url": "https://github.com/miorel"
1414
},
15+
"type": "module",
1516
"exports": {
1617
"./*": "./src/*.ts",
18+
".": null,
1719
"./__tests__/*": null
1820
},
1921
"scripts": {
2022
"format": "prettier --color --write .",
2123
"lint": "eslint --color --max-warnings=0 .",
22-
"test": "tsx ./jest.config.mts",
24+
"test": "tsx ./jest.config.ts",
2325
"typecheck": "tsc --pretty --project ."
2426
},
25-
"dependencies": {
27+
"peerDependencies": {
2628
"invariant": "2.2.4",
27-
"nullthrows": "patch:nullthrows@npm%3A1.1.1#~/.yarn/patches/nullthrows-npm-1.1.1-3d1f817134.patch",
29+
"nullthrows": "*",
2830
"zod": "3.23.8"
2931
},
3032
"devDependencies": {
3133
"@code-chronicles/eslint-config": "workspace:*",
34+
"@code-chronicles/util": "workspace:*",
3235
"@jest/globals": "29.7.0",
3336
"@types/node": "22.5.5",
3437
"eslint": "9.11.0",

workspaces/util/src/__tests__/distinctArray-test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, expect, it } from "@jest/globals";
2-
import { distinctArray } from "../distinctArray";
2+
3+
import { distinctArray } from "../distinctArray.ts";
34

45
describe("distinctArray", () => {
56
it("returns an empty list if given an empty list", () => {

0 commit comments

Comments
 (0)