Skip to content

Commit 7a3ab1d

Browse files
committed
esm
1 parent 38f8bfb commit 7a3ab1d

File tree

13 files changed

+30
-151
lines changed

13 files changed

+30
-151
lines changed

.yarn/patches/nullthrows-npm-1.1.1-3d1f817134.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ index d4953f2f47b79701e5f125b9c041fb185668dd53..5c48891acb35ca7ac8a3393e54cd89a1
1010
+ value?: T | null,
1111
+ message?: string,
1212
+): NonNullable<T>;
13-
13+
1414
-export default function nullthrows<T>(value?: T | null, message?: string): T;
1515
+// Patched based on https://github.com/microsoft/TypeScript/issues/46770#issuecomment-1039459991 and https://github.com/zertosh/nullthrows/pull/15
1616
+

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"workspaces/repository-scripts",
1919
"workspaces/util"
2020
],
21+
"type": "module",
2122
"scripts": {
2223
"format": "yarn workspace @code-chronicles/repository-scripts start format",
2324
"lint": "yarn workspace @code-chronicles/repository-scripts start lint",

workspaces/adventure-pack/goodies/typescript/Iterator.prototype.drop/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "../Iterator.prototype.toIterable";
1+
import "../Iterator.prototype.toIterable/index.ts";
22
import { iteratorPrototype } from "../Iterator.prototype/index.ts";
33

44
declare global {

workspaces/adventure-pack/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"goodies:typescript:test": "jest --color \"/goodies/typescript/\"",
5151
"build-app": "tsx src/scripts/build/main.ts",
5252
"build-chrome-extension": "tsx src/scripts/build/buildChromeExtension.ts",
53-
"package-goodies:test": "jest --color --testPathIgnorePatterns=\"<rootDir>/goodies/\"",
53+
"package-goodies:test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --color --testPathIgnorePatterns=\"<rootDir>/goodies/\"",
5454
"format": "yarn goodies:java:format && yarn goodies:kotlin:format && yarn goodies:python3:format && yarn goodies:typescript:format && prettier --color --write .",
5555
"lint": "eslint --color --max-warnings=0 .",
5656
"postinstall": "yarn goodies:java:install && yarn goodies:kotlin:install && yarn goodies:python3:install",
@@ -73,6 +73,7 @@
7373
"@types/react": "18.3.5",
7474
"@types/react-dom": "18.3.0",
7575
"@types/react-syntax-highlighter": "15.5.13",
76+
"cross-env": "7.0.3",
7677
"eslint": "9.10.0",
7778
"jest": "29.7.0",
7879
"prettier": "3.3.3",

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,17 +2061,18 @@ exports[`App can equip single goody: JavaScript Map.groupBy 1`] = `
20612061

20622062
Map.groupBy ??= function (iterable, callbackFn) {
20632063
const groups = new Map();
2064+
20642065
let index = 0;
20652066
for (const value of iterable) {
2066-
const key = callbackFn(value, index);
2067+
const key = callbackFn(value, index++);
20672068
const group = groups.get(key);
20682069
if (group == null) {
20692070
groups.set(key, [value]);
20702071
} else {
20712072
group.push(value);
20722073
}
2073-
++index;
20742074
}
2075+
20752076
return groups;
20762077
};
20772078

@@ -4391,17 +4392,18 @@ Map.groupBy ??= function <K, V>(
43914392
callbackFn: (value: V, index: number) => K,
43924393
): Map<K, V[]> {
43934394
const groups = new Map<K, V[]>();
4395+
43944396
let index = 0;
43954397
for (const value of iterable) {
4396-
const key = callbackFn(value, index);
4398+
const key = callbackFn(value, index++);
43974399
const group = groups.get(key);
43984400
if (group == null) {
43994401
groups.set(key, [value]);
44004402
} else {
44014403
group.push(value);
44024404
}
4403-
++index;
44044405
}
4406+
44054407
return groups;
44064408
};
44074409

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,17 +1128,18 @@ iteratorPrototype.toSet ??= function () {
11281128
exports[`App can render goody: JavaScript Map.groupBy 1`] = `
11291129
"Map.groupBy ??= function (iterable, callbackFn) {
11301130
const groups = new Map();
1131+
11311132
let index = 0;
11321133
for (const value of iterable) {
1133-
const key = callbackFn(value, index);
1134+
const key = callbackFn(value, index++);
11341135
const group = groups.get(key);
11351136
if (group == null) {
11361137
groups.set(key, [value]);
11371138
} else {
11381139
group.push(value);
11391140
}
1140-
++index;
11411141
}
1142+
11421143
return groups;
11431144
};"
11441145
`;
@@ -2506,17 +2507,18 @@ Map.groupBy ??= function <K, V>(
25062507
callbackFn: (value: V, index: number) => K,
25072508
): Map<K, V[]> {
25082509
const groups = new Map<K, V[]>();
2510+
25092511
let index = 0;
25102512
for (const value of iterable) {
2511-
const key = callbackFn(value, index);
2513+
const key = callbackFn(value, index++);
25122514
const group = groups.get(key);
25132515
if (group == null) {
25142516
groups.set(key, [value]);
25152517
} else {
25162518
group.push(value);
25172519
}
2518-
++index;
25192520
}
2521+
25202522
return groups;
25212523
};"
25222524
`;

workspaces/adventure-pack/src/app/components/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { useAppState } from "../useAppState.ts";
99
import type { Goody } from "../Goody.ts";
1010
import { LanguageSelector } from "./LanguageSelector.tsx";
1111

12+
// TODO: add a lint rule that files are imported with their actual extension (i.e. ".tsx" not ".ts" where applicable)
13+
1214
function Column({
1315
children,
1416
flex,

workspaces/adventure-pack/src/app/stringifyTypeScriptModuleDeclarations.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { isStringEmptyOrWhitespaceOnly } from "@code-chronicles/util/isStringEmp
55
import type { GoodyModuleDeclaration } from "../scripts/package-goodies/typescript/extractModuleDeclarations.ts";
66
import { stringifyTypeScriptInterfaceDeclarations } from "./stringifyTypeScriptInterfaceDeclarations.ts";
77

8+
// TODO: we should probably not allow impoting stuff from the scripts, even if it's just the type
9+
810
const INDENT = " ";
911

1012
export function stringifyTypeScriptModuleDeclarations(

workspaces/adventure-pack/src/app/useAppState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import immutableUpdate from "immutability-helper";
2-
import { useReducer, type Dispatch as ReactDispatch } from "react";
2+
import { type Dispatch as ReactDispatch, useReducer } from "react";
33

44
import type { GoodiesByLanguage } from "./fetchGoodies.ts";
55
import type { Language } from "./Language.ts";

workspaces/adventure-pack/src/scripts/package-goodies/typescript/formatCode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as prettier from "prettier";
1+
import prettier from "prettier";
22

33
export function formatCode(code: string): Promise<string> {
44
return prettier.format(code, { parser: "typescript" });

0 commit comments

Comments
 (0)